Search Results

Search found 1 results on 1 pages for 'sike12'.

Page 1/1 | 1 

  • Changing colour of text in a textblock via a trigger

    - by Sike12
    Here is my Xaml <Window.Resources> <sampleData:MainWindow x:Key="DataSource"/> <DataTemplate x:Key="bobReferencer"> <TextBlock Text="{Binding Name}" > <TextBlock.Style> <Style TargetType="TextBlock"> <Style.Triggers> <DataTrigger Binding="{Binding HasErrors}" Value="true"> //what goes in here? </DataTrigger> </Style.Triggers> </Style> </TextBlock.Style> </TextBlock> </DataTemplate> </Window.Resources> Codebehind (the one xaml references) public class bob { public string Name { get; set; } public bool HasErrors { get; set; } Basically what i want to do is if the HasErrors is true then i want the Name to appear in Red via the trigger. But my xaml is not properly formed. Any suggestions on this? I also looked into this link but didn't help much. How can I change the Foreground color of a TextBlock with a Trigger?

    Read the article

1