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
160
Keystroke to close expansion on UltraWinGrid used as a Tree
posted

I'd like to be able to use Keys.Escape to close the currently expanded UltraWinGrid element when using this as a tree, but don't know how to begin.  I have captured the KeyDown event ok, but what next?  Manually, we do this by clicking on the ExpansionIndicatorUIElement to close the tree.  The number of rows is large, so scrolling back up to close the tree each time is tedious.

  • 469350
    Suggested Answer
    Offline posted

    Hi Mark,

    The Escape key already has some functionality in the grid by default. It will cancel the current cell edit, and then cancel all edits for the current row. So using Escape will be a bit complicated if you are allowing the user to edit the grid.

    If not, then this should be very simple.


            private void ultraGrid1_KeyUp(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Escape)
                {
                    UltraGridRow row = this.ultraGrid1.ActiveRow;
                    while (null != row)
                    {
                        row.Expanded = false;
                        row = row.ParentRow;
                    }
                }
            }

  • 48586
    posted

    Hello,

     

    I am just checking about the progress of this issue. Let me know If you need our further assistance on this  issue?

     

    Thank you for using Infragistics Components.