I need to execute some code when the user click on the column heander instead to sort them, It´s that posible?
Thanks in advace,
Alejandro Castrejon
One way is to set SortIndicator to 'None' for the column, then handle the AfterSelectChange event for column selection. This event will also fire, however, when a column is programmatically selected, so if you need to unambiguously identify a click on the header, you can do this:
void ultraGrid_MouseClick(object sender, MouseEventArgs e){ UltraGrid control = sender as UltraGrid; UIElement controlElement = control.DisplayLayout.UIElement; UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( e.Location ) : null; UltraGridColumn column = null;
while ( elementAtPoint != null ) { HeaderUIElement headerElement = elementAtPoint as HeaderUIElement; column = headerElement != null ? headerElement.GetContext( typeof(UltraGridColumn) ) as UltraGridColumn : null; if ( column != null ) break;
elementAtPoint = elementAtPoint.Parent; }
if ( column != null ) { // Do stuff here }
}
Works fine, Thanks for your help.
Regards,
Aejandro Castrejon