Is there a way to allow a property of a user control to be modified only during design time?

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-03-16T16:07:52Z Indexed on 2010/03/16 16:11 UTC
Read the original article Hit count: 234

I've looked into the DesignOnly attribute, but that doesn't seem to accomplish what I want*.

Basically, I'm looking for some way to indicate that some property of a user control (let's say Text) can be modified during design time -- i.e., from the Windows Forms designer in VS (or presumably from any GUI designer that can be used to modify a Windows Forms GUI) -- but not during run time. Once the application is running, the property should effectively be readonly.

Is this possible?

* When I add the DesignOnly attribute to a property, the value I select for that property from design mode doesn't seem to stick; the property just ends up being whatever I have it set to by default in code.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about windows-forms