I have three kind of separate checkbox questions, all related to their use in the same datagrid.
-
I've loaded a datatable,
dtAll
, into a datagrid,dgdList
, and bound each column to the imported data. The datagrid also has an initial column with checkboxes. How can I determine which rows of data have been checked. The intended functionality is for a user to mark two duplicates and merge together. I need to be able to gather row data from the datatable or datagrid whenever the checkbox column is checked -
When I group my datagrid into tables, below, it somehow turns off my ability to check more than one checkbox. Everytime i select a new row, it clears all previous checkboxes. I would like to be able to check boxes in multiple rows. (Further, I have to click twice, once to select the row, once to edit the value of the checkbox to true - it would be great if I could do it in a single click).
<!-- language: lang-vb -->Dim myView As System.ComponentModel.ICollectionView myView = CollectionViewSource.GetDefaultView(dtAll) myView.GroupDescriptions.Add(New PropertyGroupDescription("GROUP ID")) dgdList.ItemsSource = dtAll.DefaultView
-
I've added a checkbox to the group header. When clicked, I'd like it to fill in each checkbox in all the rows inside of that group. Is there any way I can do this as well? If it helps, below is the Xaml code I'm using to split up groups of records
<!-- language: lang-xml --><DataGrid.GroupStyle> <GroupStyle> <GroupStyle.HeaderTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=Name}" /> </StackPanel> </DataTemplate> </GroupStyle.HeaderTemplate> <GroupStyle.ContainerStyle> <Style TargetType="{x:Type GroupItem}" x:Name="Style1"> <Setter Property="Template" x:Name="Setter1"> <Setter.Value> <ControlTemplate TargetType="{x:Type GroupItem}" x:Name="ControlTemplate1"> <Expander IsExpanded="True" Name="Expander1"> <Expander.Header> <StackPanel Orientation="Horizontal"> <CheckBox Name="CheckBox9" /> <TextBlock Text=" Exact Name Match Group #"/> <TextBlock Text="{Binding Path=Name}" /> </StackPanel> </Expander.Header> <ItemsPresenter /> </Expander> </ControlTemplate> </Setter.Value> </Setter> </Style> </GroupStyle.ContainerStyle> </GroupStyle> </DataGrid.GroupStyle>