tags:

views:

16

answers:

1
  <my:DataGrid.RowHeaderTemplate>
                        <DataTemplate>
                            <Grid>
                                <CheckBox Name="dgChkSelect" Checked="dgChkSelect_Checked" Unchecked="dgChkSelect_Unchecked" Tag="{Binding}" />
                                <!--IsChecked="{Binding Path=IsSelected,Mode=TwoWay,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:DataGridRow}}}"-->
                            </Grid>
                        </DataTemplate>
                    </my:DataGrid.RowHeaderTemplate>

Hi all, I want to loop through the datagrid data to retrieve those records has been checked. Anyone know how to do this?

A: 

You were in the right path add IsChecked="{Binding Path=IsSelected, Mode=TwoWay}". Dont have the rest of the relative source stuff. Datagrid's itemsource will be searched for the property IsSelected; Make sure you have a property. On a separate note why aren't you using DataGridCheckBoxColumn.

anivas