locked
Set Foreground Color, but how? RRS feed

  • Question

  • Hi,

    i have a WPF Datagrid with a Field that i will Change the Color via C#...

    Here is the WPF Code

                       <DataGridTemplateColumn Header="Nr " Width="38" CanUserSort="True" x:Name="SP001" >
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Label x:Name="SP001F" Height="50" Content="{Binding GrLaufendePosition}" Foreground="Black" Background="White" HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderThickness="0" VerticalAlignment="Center"  />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

    SP001.Foreground = "Red";       is wrong :-(

    SP001F can i not type...

    Have anyone a idea?

    Best regards

    Bernd

    Sunday, June 28, 2020 3:05 PM