Cason
Cason

Reputation: 95

Control.OnCreateControl cannot judge DesignMode when used in a UserControl

I have a control class inherent from ListView and put in a User Control, and want to do something once after constructor, so I override OnCreateControl(). But I found neither Design Mode or LicenseManager.UsageMode can judge design time when the UserControl is put in a Form and view by designer. Is there anyway to work around?

Upvotes: 1

Views: 276

Answers (1)

Suresh Kumar Veluswamy
Suresh Kumar Veluswamy

Reputation: 4353

A user control contains a property called DesignMode, but examining just it's value isn't enough. The DesignMode should be evaluated for the control and for the whole parent hierarchy in order to know the status of the application.

You can refer the below link for resolving the design mode of a user control http://www.codeproject.com/Tips/447319/Resolve-DesignMode-for-a-user-control

Upvotes: 1

Related Questions