I’m struggling to workout what the relationship is with CellUIElement and the UltraGridCell. I understand that you can derive the UltraGridCell from the GetContext method of the CellUIElement, but how are the two related? Can someone please explain the relationship beween these objects and how and when they are created.
Kind Regards,
Tim
Hi Tim,
Hm... the distinction is pretty clear in my minds, but I am finding it a bit difficult to put into words.
The UltraGridCell represents a cell in a row. It has properties related to the cell, such as the Value, a reference to the column, a Style, a Hidden property, etc.
The UIElement is a visual representation of the cell and contains the child elements that make up that cell on the screen (and potentially in a printed document, as well). UIElements are a concept that is part of the Infragistics WinForms Presentation Layout Framework. Everything you see on the screen in any of the WinForms controls is handled by UIElements.
Most of the time, you really don't need to use UIElements at all. They are there to provide a framework for drawing controls and objects and they can be used to provide advanced extensibility if you need to do something that the control doesn't ordinarily do.
You might get a better understanding of UIElements if you check out the Infragistics UIElementViewer Utility
Hi Mike,
Thanks for your reply. I’ve already used UIElementViewer so have a basic understanding of the UIElement hierarchy within the UltraGrid model. I guess the best way to understand my issues is to consider attempting to write replacement objects for UltraGridCell and CellUIElement.
1) I understand how to create and embed custom UIElements using a creation filter; however I do not understand how you are able to derive the appropriate UltraGridCell from the CellUIElement. Is there simply a reference from one object to another, does one inherit from the other or does it use the row and column information to derive the correct UltraGridCell. I’ll need to copy this behavior in my model so should really understand how the GetContext method really works.
2) Could you point me in the direction of where I can find out more information about the drawing of custom UIElements as I’m currently drawing my UIElement object by overriding the DrawBorders method after inheriting from UIElement directly? This has some funny behaviours when expanding the row height as these objects may disappear from the screen but do still exist within the grid hiarchy. Is there a specific method that I should be overriding to control the drawing of my object? Note: I’m not currently using a draw filter.
3) Is it possible to derive the appropriate column key from the RowCellAreaUIElement within a creation filter so that I can replace the existing CellUIElements with my own UIElements?
Thanks again for all your help.
Regards,