<my:DataGrid.RowHeaderTemplate>
开发者_如何学Python <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?
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
.
精彩评论