Hi
How can i disable selection in XamDatagrid?
I want to disable selection when i start tot do some input operations in some fields
that are related with the columns of the grid.
Claudiu
I want to exclude child row from selection.. I mean if suppose hirarchical data is present in grid and if user expand to see secondary child row then it should be only for display..user cant select or activate that record. Please let me know how to achieve this.
Hello,
Thanks for the update. Now it is much more clearer. In this case you can use the RecordAdded (disable all the records, except the added one) and RecordUpdated (enable all the records) events. If you add the new record on top or bottom of the grid it will be even easier to disable all the other records with Enabled property ( myRecord.Enabled = false; for example).
Hope this helps.
Alex.
Thanks for the answer, but is not what i'm looking for.
My grid is readonly.
I'm updating the grid data source form code with values for other controls.
I just want to disable selection in the grid when i'm doing this operation.
Example:
I have a toolbar with actions like add, delete, modify.
When i hit add I'm adding a new record to the grid(with default values) and I'm selecting it.
From this moment I want the user to not be able to select any other record form the grid till i hit a save button, when i populete the new record added with values.
Hello Claidiu,
Here is one way to disable all the cells except the one you are updating:
private void xamDataGrid1_EditModeStarted(object sender, Infragistics.Windows.DataPresenter.Events.EditModeStartedEventArgs e) { Cell currentCell=e.Cell; DataRecord currentRecord = currentCell.Record; foreach(Cell c in currentRecord.Cells) { if (c != currentCell) { c.Field.Settings.AllowEdit = false; } } } private void xamDataGrid1_EditModeEnded(object sender, Infragistics.Windows.DataPresenter.Events.EditModeEndedEventArgs e) { Cell currentCell = e.Cell; DataRecord currentRecord = currentCell.Record; foreach (Cell c in currentRecord.Cells) { if (c != currentCell) { c.Field.Settings.AllowEdit = true; } } }
Hope this helps.Alex.