Hi
I need to identify the summary row from mouse positions. And the below code doesn't seem to work.
(currentUIElement is type of Infragistics.Win.UIElement)
currentUIElement.GetContext(typeof(UltraGridSummaryRow)) as UltraGridSummaryRow;
it will return null when I click on the summary row. :-(
Do you know what is the best way to achieve this?
Many thanks
Lan
Thanks very much for the reply! That's exactly what I am looking for.
The following code sample demonstrates how to use the UIElement's ElementFromPoint method to determine whether the user clicked a summary "cell":
void ultraGrid_MouseDown(object sender, MouseEventArgs e){ UltraGrid grid = sender as UltraGrid; UIElement controlElement = grid.DisplayLayout.UIElement; UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( e.Location ) : null; SummaryValue summaryValue = elementAtPoint != null ? elementAtPoint.GetContext( typeof(SummaryValue) ) as SummaryValue : null; UltraGridColumn column = summaryValue != null ? summaryValue.SummarySettings.SourceColumn : null;
// If 'column' is not null, the mouse was pressed over a "summary row", // and the column reference tells you which "cell" therein. if ( column != null ) { }}
Hi Lan,
I'm not sure how an UltraGridSummaryRow helps you in that case. It seems to me that all you need to do is determine if the UIElement you click on or one if it's ancestors is a SummaryRowUIElement. Getting the UltraGridSummaryRow doesn't really give you anything useful.
In fact, it seems like you want to get a SummarySettings or a SummaryValue object using GetContext. Not UltraGridSummaryRow.
HI Mike
What I need is to wire in some logic when certain cells of the summary row are clicked.
So I need determine from the position of the mouse:
1. Is it on a summary row?
2. if 1 is true, what column is the mouse pointing at
Thanks
Why do you want an UltraGridSummaryRow? There's really not much you can do with this object. In fact, it's not even a real row. The UltraGridSummaryRow object exists only as a sort've placeholder for use when exporting the grid. Which is probably why GetContext doesn't work.
If you can tell me why you want the UltraGridSummaryRow and what you are trying to accomplish, perhaps I can tell you a better way to do it.