WPF: Checkbox in a ListView/Gridview--How to Get ListItem in Checked/Unchecked Event?
        Posted  
        
            by Phil Sandler
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Phil Sandler
        
        
        
        Published on 2010-04-21T20:04:55Z
        Indexed on 
            2010/04/21
            21:13 UTC
        
        
        Read the original article
        Hit count: 1449
        
In the code behind's CheckBox_Checked and CheckBox_Unchecked events, I'd like to be able to access the item in MyList that the checkbox is bound to.
Is there an easy way to do this?
<ListView ItemsSource="{Binding Path=MyList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" MinHeight="100" MaxHeight="100">
  <ListView.View>
    <GridView>
      <GridViewColumn>                            
        <GridViewColumn.CellTemplate>
          <DataTemplate>
            <CheckBox Margin="-4,0,-4,0" IsChecked="{Binding MyBoolProperty}" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" />
          </DataTemplate>
        </GridViewColumn.CellTemplate>
      </GridViewColumn>
    </GridView>
  </ListView.View>
</ListView>
        © Stack Overflow or respective owner