I have a this code:
<ListView Grid.Row="0" Grid.Column="0" Margin="5" HorizontalAlignment="Stretch" Name="netcastListView" ItemsSource="{Binding NetcastList}">
<ListView.View>
<GridView>
<GridViewColumn Width="Auto">
<GridViewColumnHeader Content="Sync" />
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsSynced}" Command="{Binding Source={StaticResource mainViewModel}, Path=UpdateNetcastCommand}" CommandParameter="{Binding}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="Auto">
<GridViewColumnHeader Content="Netcast" />
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ShowTitle}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.开发者_如何学运维View>
</ListView>
When I select an item in the listview, it unchecks the checkbox which bleeds through to the binding. How can I prevent this?
Edit / Clarification: What I want to prevent is the checkbox from being affected when the item is selected.
If you don't need to modify the checkbox, then change the binding to OneWay
and/or set IsEnabled
on the checkbox to False
精彩评论