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
1401
ColumnHeaderMouseClick Event in UltraGrid
posted

Hi,

There is an event called "ColumnHeaderMouseClick" in Windows.Forms.DataGridView. is there any similar event

available with UltraWinGrid.UltraGrid ?

Parents
  • 69832
    Suggested Answer
    Offline posted

    No, there is not event that notifies of a single click (there is, however, a DoubleClickHeader event). Note that you could handle the control's MouseClick event and hit test for a column header.

    Example:
    void ultraGrid_MouseClick(object sender, MouseEventArgs e)
    {
        UltraGrid grid = sender as UltraGrid;
        UIElement controlElement = grid.DisplayLayout.UIElement;
        UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint(e.Location) : null;
        UltraGridColumn column = null;
        while ( elementAtPoint != null )
        {
            HeaderUIElement headerElement = elementAtPoint as HeaderUIElement;
            if ( headerElement != null &&
                 headerElement.Header is Infragistics.Win.UltraWinGrid.ColumnHeader )
            {
                column = headerElement.GetContext( typeof(UltraGridColumn) ) as UltraGridColumn;
                break;
            }

            elementAtPoint = elementAtPoint.Parent;
        }
    }

Reply Children