We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How can I place a UserControl in the header cell of GridGroupingControl?

In order to have a User Control in GridGroupingControl, the GridGenericCellModel and GridGenericCellRenderer classes have to be derived and the User Control that is designed must be made as a cellmodel in GridGroupingControl using these derived classes.

The following are the steps that need to be followed:

Step 1: The UserControl form is added to the Project and the required controls are dropped into it.

In the UserControl, the OnLayout() method is overridden for positioning the inner button controls.

C#

VB

Step 2: Create CustomControlCellModel by deriving it from GridGenericCellModel class.

C#

VB

Step 3: Create CustomControlCellRenderer from the GridGenericCellRenderer class and the UserControl is drawn accordingly to fit into the required cell header.

C#

VB

Step 4: You can create a new CellType by adding the instance of the derived CustomControlCellModel class into the gridGroupingControl’s CellModels.

C#

VB

Step 5: Set the CustomControl into the specific header cell.

C#

VB

After applying the properties, the Grid is displayed as follows.

Figure 1: Grid with the properties

Sample Links

CS: UserControl

VB: UserControl

Article ID: Published Date: Last Revised Date: Platform: Control:
704 04/30/2011 02/12/2016 Windows Forms GridGroupingControl
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.