I have a key mapping to expand the selected row. I would like it to function on all selected rows. Is it possible?
// Add a custom key/ction mapping to the grid to expand the current row. theGrid.KeyActionMappings.Add(new GridKeyActionMapping(Keys.Down, UltraGridAction.ExpandRow, 0, UltraGridState.RowExpandable, 0, SpecialKeys.ShiftCtrl, true));
Hi Kipp,
Since there's no UltraGridAction for "ExpandAllSelectedRows", KeyActionMappings probably isn't a good way to handle this. I'd just handle the grid's KeyDown event and watch for the Down arrow, then loop through the Selected Rows and Expand each one. Be sure to set e.Handled to true inside the event so that the grid doesn't process the key.
private void ultraGrid1_KeyDown(object sender, KeyEventArgs e) { var grid = (UltraGrid)sender; if (e.KeyCode == Keys.Down) { e.Handled = true; foreach (var row in grid.Selected.Rows) { row.Expanded = true; } } }
private void ultraGrid1_KeyDown(object sender, KeyEventArgs e) { var grid = (UltraGrid)sender; if (e.KeyCode == Keys.Down) { e.Handled = true;
foreach (var row in grid.Selected.Rows) { row.Expanded = true; } } }
private void ultraGrid1_KeyDown(object sender, KeyEventArgs e)
{
var grid = (UltraGrid)sender;
if (e.KeyCode == Keys.Down)
e.Handled = true;
foreach (var row in grid.Selected.Rows)
row.Expanded = true;
}
Thanks Mike.
I wanted to make sure there wasn't some way to link in some custom action.
I'm curious. You suggested using Key-Down. I would think Key-Up would be a better choice. Do you have any thoughts on this?