Datatemplate binding
Posted
by Lasse O
on Stack Overflow
See other posts from Stack Overflow
or by Lasse O
Published on 2010-06-08T21:23:32Z
Indexed on
2010/06/08
21:32 UTC
Read the original article
Hit count: 336
wpf
How can i achieve something like this:
<ListView Name="OverviewTitlesListView" ItemsSource="{Binding OverviewTitlesCollection}">
<ListView.View>
<GridView>
<GridViewColumn Header="Index" Width="60" DisplayMemberBinding="{Binding TitleIndex}"/>
<GridViewColumn Header="Start Time" Width="100" DisplayMemberBinding="{Binding StartTime}"/>
<GridViewColumn Header="End Time" Width="100" DisplayMemberBinding="{Binding EndTime}"/>
<GridViewColumn Header="Title Text" Width="550" DisplayMemberBinding="{Binding Text}"/>
<GridViewColumn Header="Approved" Width="80">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Name="Test"/>
<DataTemplate.Triggers>
<Trigger Property="{Binding IsApproved}" Value="true">
<Setter TargetName="Test" Property="Text" Value="Approved"/>
</Trigger>
<Trigger Property="{Binding IsApproved}" Value="false">
<Setter TargetName="Test" Property="Text" Value="Not Approved"/>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
When IsApproved property changes on my object in OverviewTitlesCollection i want to control the text of the TextBlock. How can i control this by triggers in my datatemplate?
© Stack Overflow or respective owner