Log in to like this post! Embed Any Control In WinGrid Col Header Using IUIElementCreationFilter Tom Puglisi / Friday, August 31, 2007 Here is a sample that I put together a while back when someone asked me about embedding "Any Control I Want" into the Column Headers of the Infragistics WinGrid. I started to explain how to think about the control that you want to place in the Header and then try to build it through the use of the Presentation Layer Framework (Known here at Infragistics as PLF) and while losing him after the term "EditorWithComboDropDownButtonUIElement", I thought to myself "Hey, why not make a sample that makes it easy for anyone to add any Control to the Headers of WinGrid?". After thinking of a way to do this in a semi-elegant way, I came up with the idea of using a Creation Filter (aka: IUIElementCreationFilter) which is a class that implements an Infragistics Interface that allows code to be written to interact with the various "UI Elements" that are being created and put together to ultimately form the WinGrid. You can test the types of UIElements that are being rendered in this class and then you can cancel their creation, modify them or even create and instantiate other UIElements and add them as Children of the current UIElement. This allows you to basically take whatever UIElements are available as part of the Infragistics Library and essentially throw them wherever you want. In other words, the WinGrid does not have a property setting that allows you to have check boxes in the column headers. To implement this, you would use a Creation Filter. Moving on to this particular example, the Creation filter is used to basically create and instantiate a standard Windows Forms Panel control per WinGrid Column Header. These Panels will then be positioned directly over each Column Header UIElement. This information is all provided in the event arguments within the methods of the Creation Filter. The Creation Filter is also called upon whenever the end user interacts with the WinGrid, therefore when headers are resized, moved or interacted with, the UIElement rectangles will change, and the Panels will follow along with them without any problems. In the end, you will never know that the Panels are just hovering over the Headers. Now that we understand this far, I neatly subclassed the WinGrid to incorporate this Creation Filter along with an Event that fires during the initialization of each Panel. This event is used by the Developer to dynamically create any control, wire up control events and then place it into the Panel. You can also determine which Header the Panel belongs to through the Event Args. This results in a WinGrid that you can basically put whatever Control (or controls) into the Column Headers. Please check out the code and comments of this example. You may need to use the Infragistics Project Upgrade Utility on this before you try to build it as it was made with 2007 Volume 1. Download Sample Enjoy! Tom