DataTrigger binding Cannot find source
Bonjour, j'ai un petit soucis de binding pour certaine raison je suis obliger d'utiliser un listView .
J'aimerais que quand je coche la checkbox du header que toutes les checkbox de ma cell soient coché (checkbox avec le tName=CheckBoxAll ), pour faire cela j'ai voulus utiliser un trigger , mais cela m'affiche dans le output de visual studio ce ci .
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=CheckBoxAll'. BindingExpression:Path=IsChecked; DataItem=null; target element is 'CheckBox' (Name=''); target property is 'NoTarget' (type 'Object')
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <ListView Grid.Row="1" ItemsSource="{Binding Path= CarrierFiledsCollectionView ,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" ScrollViewer.VerticalScrollBarVisibility="Auto" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Stretch" SelectionMode="Single" SelectedItem="{Binding Path=SelectedCarrier, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalContentAlignment="Center" >
<ListView.View >
<GridView >
<GridViewColumn Width="auto" >
<GridViewColumn.HeaderTemplate>
<DataTemplate>
<CheckBox Name="CheckBoxAll" IsChecked="True"/>
</DataTemplate>
</GridViewColumn.HeaderTemplate>
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox>
<CheckBox.Style>
<Style TargetType="CheckBox">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=CheckBoxAll, Path=IsChecked}" Value="True">
<Setter Property="IsChecked" Value="True"/>
</DataTrigger>
</Style.Triggers>
</Style>
</CheckBox.Style>
</CheckBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView> |
Merci d'avance pour votre aide .:P