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
375
KeyActionMappings UltraGridAction.ExpandRow expand all selected rows?
posted

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));

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    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;

    }

    }

    }

Children