[WPF] Binding TwoWay CheckBox
Bonjour, j'ai un petit soucis concernant un binding d'une checkbox en mode TwoWay.
J'ai ceci côté xaml :
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
|
<ListBox Name="Box" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="3" ItemsSource="{Binding Search}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="250" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="70" />
<RowDefinition Height="70" />
</Grid.RowDefinitions>
<Image Margin="2" Source="{Binding Image, Converter={StaticResource BinaryToImage}}" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" />
<Label Content="{Binding Title}" Grid.Column="1" Grid.Row="0" FontWeight="Bold" FontSize="13" VerticalAlignment="Center" />
<CheckBox Grid.Row="1" Grid.Column="1" Content="Ajouter" IsChecked="{Binding Checked, Mode=TwoWay}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox> |
Search est une observable collection d'un type personnalisé. En fait je voudrais que lorsque côté UI je coche la checkbox, ba la valeur Bindée se mette à true. Or même avec le binding two way a ne fonctionne pas. Comment puis-je faire ?
Merci d'avance.
Cordialement,
NeoKript