|
Hi all,
I don't understand how to correctly implement default values for controls properties, and can't find anything in the docs or any of my manuals about it! I have something like: <CODE>
private string _HeaderText = "MyControl";
[DefaultValue(typeof(string),"MyControl")] public string HeaderText { get{return _HeaderText;} set{_HeaderText = value; drawHeader();} } </CODE>
This works in terms of the default value coming through to the designer, and I can change the text in the designer and it updates fine, however the actual run time interface ignores the settings set at design time and just goes back to "MyControl".
If I do not set the private _HeaderText = "MyControl" (and simply declare it) then the default value does not come through to the designer.
I'm confused because I thought that the [DefaultValue("value")] is what is used for the designer value. ???
Help!
|