私はRadDataBoundListBoxを持っています(より多くのオプションやプロパティなどを備えた高度なリストボックスです...)私のListBoxは通知のリストにバインドされています、すべての通知にはboolプロパティUnreadがあります、私がしたいのはアイテムが未読(未読)の場合です= true)フォントの色を青にしたいのですが、未読= falseの場合、フォントの色は白のままです...これを行う方法がわかりません
これは私のリストボックスコードです:
<telerikPrimitives:RadDataBoundListBox
HorizontalAlignment="Left"
Margin="3,4,0,0"
Name="radListNotifications"
VerticalAlignment="Top"
Width="453"
SelectionChanged="radListNotifications_SelectionChanged">
<telerikPrimitives:RadDataBoundListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Message}"
TextWrapping="Wrap"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Padding="0,3,0,0"
FontFamily="{StaticResource PhoneFontFamilyLight}"
FontSize="{StaticResource PhoneFontSizeExtraLarge}"
Foreground="{StaticResource PhoneForegroundBrush}"
LineStackingStrategy="BlockLineHeight"
LineHeight="43" />
<TextBlock Text="{Binding Time}"
Opacity="0.65"
HorizontalAlignment="Left"
FontSize="{StaticResource PhoneFontSizeSmall}"
TextWrapping="Wrap"
VerticalAlignment="Top"
Foreground="{StaticResource PhoneForegroundBrush}"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
Margin="0,0,0,13"/>
</StackPanel>
</DataTemplate>
</telerikPrimitives:RadDataBoundListBox.ItemTemplate>
</telerikPrimitives:RadDataBoundListBox>
そして、これが私がItemSourceを適用するコードです:
List<TimeTierUserActions.Notification> listNotifications = e.Result.ToList();
radListNotifications.ItemsSource = listNotifications;
私がこれをどのように達成できるか知っていますか?つまり、通知が[読み取り]の場合、フォントの色は同じままですが、未読の場合はアイテムの色を変更します(通知)。
ロードされたときのリストボックスのスクリーンショットは次のとおりです