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
170
Problems retrieving UltraGridCell from RowCellAreaUIElement
posted

I am implementing a DrawFilter and am inside of the GetPhasesToFilter method and have the following code:

public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams)
{
	var cell = drawParams.Element as RowCellAreaUIElement;
	if (cell != null)
	{
		var ultraCell = (UltraGridCell)cell.GetContext();
		// do stuff with ultraCell and return the appropriate draw phase
	}
	return DrawPhase.None;
}

However, the context being retrieved is an UltraGridRow, not a Cell. I have tried using .GetContext(typeof(UltraGridCell)), but then just get null as my result.
In searching the forums, I have seen previous users remark that they have used GetContext on a cell UIElement and found success in retrieving the UltraGridCell.

How can I get the UltraGridCell from within this method?

Thanks

  • 170
    Verified Answer
    posted

    Doh. I just figured it out. I needed to cast to a CellUIElement (in order to be down at the cell level), not a RowCellAreaUIElement. Once I changed that, things worked fine.