Geeks With Blogs
Devin Rader's Blog I write the code...

A core concept of the Infragistics NetAdvantage Windows Forms control is the idea of UIElements. UIElements are the individual elements of a control, that when drawn together give you the familiar look you are used to. A great part of using the NetAdvantage controls is that we expose hooks into the controls as they draw each individual UIElement, so that you can inject your own custom drawing logic. There are two means by which you can interact with the individual UIElements in the Windows Forms controls:

  • Draw Filters - An extensibility mechanism used to customize the rendering of a UIElement
  • Creation Filters - Used to add new or remove existing UIElements from the controls

(Shameless plug: You can learn more about using Draw Filters and Creation Filters in the instructor lead Infragistics training course "Advanced Development using NetAdvantage", or through the online courses "NetAdvantage Windows Forms Elements + PLF" or "Advanced PLF Windows Forms Development")

One key thing you need to know if you want to start interacting with the controls at this level is exactly which UIElement you want to change. This can be a daunting task if you are not intimately familiar with the UIElement structure of the controls.

To make this task easier, I am publishing* a tool that we have used internally for a while now called the UIElementViewer. This is a simple non-visual control that you can add to your form that will help you figure out which UIElement you want to work with.

Download Here * Disclaimer: This is an unsupported utility.  Use at your own risk.

Using the UIElementViewer Control

To begin using the control, simply add it to a form that has the NetAdvantage control you want to examine. Once that’s done, simply call the Show() method on the control (I generally just add it to the Form_Load event).

uiElementViewer1.Show();

When you run your application the controls dialog should show up. Check the 'Follow Mouse' checkbox and run your mouse over the NetAdvantage controls on the form. The UIElementViewer should begin to display information about the Element Tree. The Element Tree view displays the hierarchical tree of UIElements in the control.  As you can see in the image below, when I run my mouse over the grid, the grid contains a hierarchy of RowUIElements, and each of those contain several child CellUIElements.

Change the UIElementViewer to Hierarchy and the display changes to only show the element hierarchy of the current node. As you can see from the image below, this view can be a little more helpful since its not quite as much data to try to sift through.

The UIElementViewer also contains information on the Derivation of the current UIElement (e.g. its object inheritance hierarchy), the elements children, siblings, current value (or image), and object properties.

Posted on Thursday, November 17, 2005 2:51 PM | Back to top


Comments on this post: Introducing the Infragistics UIElementViewer Utility

# re: Introducing the Infragistics UIElementViewer Utility
Requesting Gravatar...
I purchased the Winforms Vol 2 and the on-line training coarse. The coarse references the UIElementViewer and include it in a lab. Yet nowhere, do they tell you where to get the dll.

I am very displeased with the training. It is something I would expect for free.

Poor execution on Infragistics part.

Left by Dan Arnold on Oct 22, 2006 11:52 PM

# re: Introducing the Infragistics UIElementViewer Utility
Requesting Gravatar...
Is the source for this utility available?
Left by Todd Peak on Sep 22, 2008 1:49 AM

# re: Introducing the Infragistics UIElementViewer Utility
Requesting Gravatar...
Does it work if I add it to WPF application where I'm hosting UltraWinGrid?
Left by Andrija on Dec 30, 2008 4:18 AM

# re: Introducing the Infragistics UIElementViewer Utility
Requesting Gravatar...
Have a look at snoop (http://blois.us/Snoop/) its a similar visual tree utility but it runs standalone.
Left by Reg Barnes on Mar 17, 2009 2:30 AM

# re: Introducing the Infragistics UIElementViewer Utility
Requesting Gravatar...
Thanks ! I'm sure I'll use it in the future.
Left by Roger on May 29, 2009 3:19 AM

# re: Introducing the Infragistics UIElementViewer Utility
Requesting Gravatar...
Your download link (http://download.infragistics.com/users/devinr/InfragisticsUIElementViewer.zip) is broken. can you fix it or tell me where i could get this VERY usefull tool?

Thanks!
Left by Giga on Mar 08, 2012 8:52 AM

# re: Introducing the Infragistics UIElementViewer Utility
Requesting Gravatar...
You can download it from here. http://blogs.infragistics.com/members/Cherokee800/files/UIElementViewer.zip.aspx
Left by Prabhu on Mar 30, 2012 3:53 PM

# re: Introducing the Infragistics UIElementViewer Utility
Requesting Gravatar...
Link broken!
Left by Andy B on May 02, 2013 7:42 AM

Your comment:
 (will show your gravatar)


Copyright © Devin Rader | Powered by: GeeksWithBlogs.net | Join free