我已經得到了類似於此頁面上的一個列表框項的數據模板一個DataTemplate ... link上觸發數據更新時
我想借這一步,做當他們改變時突出物品的東西。例如,使用上面鏈接中的代碼,我想在Widget.Quantity更改時觸發某些操作。也許使quiantity項目(沒有別的)閃光什麼的。我怎樣才能做到這一點?我包括下面的相關代碼...
<Window.Resources>
<Style x:Key="RoundedItem" TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border CornerRadius="10" BorderBrush="Black" BorderThickness="1" Margin="1">
<ContentPresenter />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate DataType="{x:Type local:Widget}">
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Name}" />
<Label Content="{Binding Quantity}" />
</StackPanel>
</DataTemplate>
</Window.Resources>
<ListBox ItemsSource="{Binding Widgets}" ItemContainerStyle="{StaticResource RoundedItem}" HorizontalContentAlignment="Stretch" />
是的,我曾經使用過類似的事情之前得到的ListBoxItem的背景選擇了整個項目何時改變。我想要檢測項目內的某些內容何時發生變化,然後對該子項目應用某種效果。在給出的示例代碼中,我想知道何時 的值發生變化,然後使該Label控件閃爍(或者做一些可見的東西)。 – flobadob 2010-08-06 13:38:22