Alan
Alan

Reputation: 2644

How to add design-time support for Enabled property in Winforms

I've created a Winforms UserControl (Visual Studio 2008, 3.5 Framework SP1). I've been able to create some of my own public properties that Visual Studio is able to properly handle (i.e. the form designer properly reacts to changing property values).

I would like to set the Enabled property a CheckBox control according to the Enabled property of the UserControl. This would be under UserControl1.cs:

 `chkMyCheckbox.Enabled = Enabled`

I have tried putting this both under the EnabledChanged event of the UserControl and overriding the OnEnabledChanged method, but neither seems to catch. This is not a toolbox caching issue (b/c I can see other code changes taking effect).

Thanks in advance, -Alan.

Upvotes: 1

Views: 1105

Answers (1)

John Arlen
John Arlen

Reputation: 6699

The way a control is rendered at Design-Time is up to the designers of that control. The core Win32 controls do not render themselves as Disabled when in the Designer.

Upvotes: 1

Related Questions