Browsable attributes won't save

  • Thread starter Thread starter proxyuser
  • Start date Start date
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;

}
 
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)]
 
Back
Top