I wanted to change the borderBrush if one of the checkbox in the itemscontrol is checked. But i just don't know how to set it. How can i refer to the IsChecked property of the checkbox in the border trigger ?
Thank's for help !
This is my xaml code:
<Border Margin="5"
Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="3"
BorderThickness="1"
>
<Border.Style>
<Style TargetType="{x:Type Border}">
<Setter Property="BorderBrush" Value="LightGray"/>
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=CheckBox, Path=IsChecked}" Value="False">
<Setter Property="BorderBrush" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=CheckBox, Path=IsChecked}" Value="True" >
<Setter Property="BorderBrush" Value="LightGray"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<ScrollViewer Height="100">
<ItemsControl Margin="5"
ItemsSource="{Binding AimList, Mode=OneWay}"
IsEnabled="{Binding IsEnable}"
>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Margin="5" Columns="2" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<CheckBox Name="CheckBox"
Content="{Binding Lib, Mode=OneWay}"
IsChecked="{Binding IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Margin="5"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
Aucun commentaire:
Enregistrer un commentaire