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
535
click to end edit
posted

When I click in the grid, but what would bee whitespace (ie to the bottom of the rows) it doesn't end editing the current cell.  How can I set it so it does?

Peter

  • 69832
    Suggested Answer
    Offline posted

    You could programmatically end the edit mode session when a mouse button is pressed over a certain point of the control.

    Example:
    this.ultraGrid1.MouseDown += new MouseEventHandler(ultraGrid1_MouseDown);

    void ultraGrid1_MouseDown(object sender, MouseEventArgs e)
    {
        UltraGrid grid = sender as UltraGrid;
        UIElement controlElement = grid.DisplayLayout.UIElement;
        UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( e.Location ) : null;
        object context = elementAtPoint != null ? elementAtPoint.GetContext( typeof(UltraGridRow) ) : null;
        if ( (context is UltraGridRow) == false )
        {
            UltraGridCell activeCell = grid.ActiveCell;
            if ( activeCell != null && activeCell.IsInEditMode )
                grid.PerformAction( UltraGridAction.ExitEditMode );
        }
    }