Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
500
XamGrid - How to toggle multiple CheckBoxes of selected rows, columns or cells
posted

Hello,

in our application we have a grid with CheckBoxColumns and the user should be able to easily check/uncheck multiple checkboxes at once.
Therefore it must be possible to select multiple rows, columns or ranges of cells to check/uncheck the containing checkboxes by using the Space key.

To make it easy for you I modified a sample from you, which was created by Stefan (MCPD) on 09-09-2013 9:43 AM for a post with the topic "XamGrid - multiple column selection through column header".
I added a method to create the grid layout, some Trace output and a KeyDown handler.

The grid you will see only contains CheckBoxColumns and it is possible to select multiple rows, columns or cells.
Please take a look at the PNG files in the attached zip file (XamGrid How to toggle multiple CheckBoxes.zip).

Problem:
The selection of multiple rows, columns or cells works fine, but when I then press the space key and my KeyDown handler is called only one cell is still selected.

Example:
If you select 3 columns you get the following trace output:
HeaderControl_PreviewMouseDown:
  grid.SelectionSettings.SelectedColumns.Count: 1
HeaderControl_PreviewMouseMove:
  grid.SelectionSettings.SelectedColumns.Count: 2
HeaderControl_PreviewMouseMove:
  grid.SelectionSettings.SelectedColumns.Count: 3

If you then press the space key you get the following trace output:
XamGrid_KeyDown:
  grid.SelectionSettings.SelectedCells.Count: 1
  grid.SelectionSettings.SelectedRows.Count: 0
  grid.SelectionSettings.SelectedColumns.Count: 0
 
This behavior has nothing to do with the CheckBox columns, because I got the same trace output with the original sample from you which had no CheckBox columns.

Questions:
1. How can I get the selection information I need to change the check/uncheck state of the selected checkboxes?
2. What would be the best way to change the check/uncheck state of multiple checkboxes in code behind?

Regards,
chrisobs

XamGrid How to toggle multiple CheckBoxes.zip
Parents Reply Children
No Data