Reputation: 73
I've already created my custom DataGridViewSliderColumn class, which renders a TrackBar inside the cell.
My question is, how can I set the type of a column to my custom DataGridViewSliderColumn in the designer? (I have defined a lot of columns on the designer).
I've tried, but only predefined column types appear on the designer.
Is possible to set it without having to alter the column definition at runtime, by code?
Upvotes: 3
Views: 5220
Reputation: 5454
Simple answer: After creating your custom column class, Rebuild your project.
For example, let's say we've created a custom Watermark column named DataGridViewWatermarkColumn
. To add it to the designer options and consequently to the DataGridView
, do the following:
In the Designer for your DataGridView
, click the arrow in the upper right corner to expand the DataGridView Tasks
.
Select Add Column...
On the Add Column Dialog, select Type -> YourCustomColumn
, then click Add
.
That's it. Do any editing necessary (such as setting the Column.WatermarkText
in this example), run it, and enjoy.
Upvotes: 2