Browsable attributes won't save

P

proxyuser

I have a text box (inherited) with some browsable attributes defined such as
the following. I instantiate one of these on a control, and open the
control in VS designer. At one point I set them to nondefault values (false
in this case) and that is how they are set in the designer.cs file. When I
try to change them back to true, it accepts it in the designer. I save, and
it looks like it works. When I close and open the control, the true value
is lost and they are back at nondefault values of false. The designer.cs
code also shows false. Any ideas?

[BrowsableAttribute(true)]

[CategoryAttribute("Behavior")]

[DescriptionAttribute("Specifies if decimal numbers are allowed")]

[DefaultValueAttribute(true)]

public bool AllowDecimal

{

get;

set;

}
 
S

Slavic Schupak

Use this attribute, it alone says to VS Designer to serialize your property,
other which you've specified, act only when designer is opened, not
influencing the code in *.Designer.cs file
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
 

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