How to: Create custom customization form
- 3 minutes to read
You can create a custom Customization Form and use it instead of the standard Customization Form. The custom form can display any elements supported by the default form, and can also provide additional layout customization functionality. This tutorial shows how to create this form.
Basic steps to create a custom Customization Form are as follows:
- Create a form by deriving it from the DevExpress.XtraLayout.Customization.UserCustomizationForm class.
- Add any standard control elements supported by the default Customization Form. At design time, you can add it via the form’s context menu.
- Add custom controls and implement the required functionality.
- Register the new Customization Form via the LayoutControl.RegisterUserCustomizationForm method.
This tutorial shows how to implement a simple Customization Form providing a Restore All button, that allows an end-user to make all hidden items visible.
Create a new form.
Switch to the code designer, and change the form’s ancestor to the UserCustomizationForm class.
- Rebuild the project by selecting the Build->Rebuild Solution menu command.
Switch to the designer. Set the form’s caption as required. In this sample, it’s set to “New Customization Form”. Now the form looks like:
Right-click the form to open the context menu, allowing you to add the standard control elements, supported by the default Customization Form:
You can add any of these elements using this menu, and then arrange the elements as required. In this example, only the Hidden Item List and Button Panel are added:
Add a SimpleButton control at the bottom of the form. Give it the Restore All caption:
Write a Click event handler for the Restore All button as follows:
In the main form’s Layout Control, register the new Customization Form via the LayoutControl.RegisterUserCustomizationForm method:
When running the main form, the new Customization Form can now be opened by right-clicking the Layout Control, and selecting the Customize Layout menu command.
The result is shown in the image below: