UserControl DesignMode

J

Jeff

I need to be able to determine wheter or not my UserControl is in DesignMode
inside the constructor. It seems that this property is not set until
sometime after the constructor has exited because it is always set to false
inside the constructor.

Is there something I am doing wrong or something else I can check to
determine wheter or not it is in design mode?

Thanks!
 
N

Nicholas Paldino [.NET/C# MVP]

Jeff,

When the constructor is called, the site for the control hasn't been set
yet, so this is why the design mode property has not been set.

I would override the Site property (specifically, the setter). When it
is set, you can check the design mode property to see if your control is in
design mode.

Hope this helps.
 
J

Jeffrey Tan[MSFT]

Hi Jeff,

Does the Nicholas's reply make sense to you?

Please feel free to feedback, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top