How to change property Fill of icon of current selected element in checkbox depending on IsChecked property?
My resource dictionary:
<UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <!-- (...) --> </ResourceDictionary.MergedDictionaries> <DataTemplate x:Key="FooTemplate"> <Icons:ExIcon Fill="Red" Width="12" Height="Auto"> <!-- <Icons:ExIcon.Triggers> <DataTrigger Binding="{Binding RelativeSource={???}}, Path=???}" Maybe here? Value="???"/> </Icons:ExIcon.Triggers> --> </Icons:ExIcon> </DataTemplate> <!-- (...) --> <styles:IconSelector x:Key="IconSelector" FooTemplate="{StaticResource FooTemplate}" FooTemplateSSecond="{StaticResource FooTemaplteSecond}"/> And listbox:
<ListBox ItemsSource="{Binding DataSources}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <!-- (...) --> <CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}"> <CheckBox.Template> <!-- (...) --> <ContentControl Name="Icon" Content="{Binding}" ContentTemplateSelector="{StaticResource IconSelector}" HorizontalAlignment="Right" Grid.Column="1"/> <!-- (...) --> </CheckBox.Template> </CheckBox> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Is it possible?