开发者

How to read the checkbox value in RowHeaderTemplate?

开发者 https://www.devze.com 2023-01-20 08:16 出处:网络
<my:DataGrid.RowHeaderTemplate> 开发者_如何学Python<DataTemplate> <Grid> <CheckBox Name=\"dgChkSelect\" Checked=\"dgChkSelect_Checked\" Unchecked=\"dgChkSelect_Unchecked\" Tag=\"{
  <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.

0

精彩评论

暂无评论...
验证码 换一张
取 消