Microsoft Communities

Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How do I add custom ColumnStyles to the designer so I can use them in a DataGrid at design time?

To use custom ColumnStyles in the designer, you need to do three things.

1) Derive a CustomColumnStyle to implement the functionality you want.

2) Derive a DataGridTableStyle class and add a new GridColumnStyles property that uses this derived CollectionEditor. This GridColumnStyle hides the base class member.

3) Derive a DataGrid and add a new TableStyles collection that uses your derived table style.

Both steps 2 and 3 will require you to derive a CollectionEditor and override CreateNewItemTypes to use the derived classes from each step in the designer.

Here is a sample project showing how you might do these things.

Contributed from George Shepherd's Windows Forms FAQ



Page view counter