2
2G
Hi,
I have a usercontrol with a custom propertie but in the designer, the
properties doesn't expand it's properties so I can't change them. I've
search google on this and came across things like
DesignerSerializationVisibilityAttribute and Type/ReferenceConverters but
can't find a good example on how to actually do this and don't know if this
is what I need.
Also, after it is possible to change the property in the designer, will the
change be saved in the code? I've had previous problems where I could change
the property (when the property class inherits from Component) but the
changes were not saved.
public class UserControl1: UserControl{
public UserControl1(){}
private Border border;
[Browsable(true),
DesignerSerializationVisibilityAttribute(DesignerSerializationVisibilityAttr
ibute.Content]
public Border Border{
get{ return this.border; }
set{
this.border = value;
}
}
}
[DefaultPropertie("Color")]
public class Border{
public Border():this(Color.Black){}
public Border(Color c){
this.Color = c;
}
private Color color;
[Category("Appearance"),
Browsable(true)]
public Color Color{
get{ return this.color; }
set{ this.color = value; }
}
}
thanks.
I have a usercontrol with a custom propertie but in the designer, the
properties doesn't expand it's properties so I can't change them. I've
search google on this and came across things like
DesignerSerializationVisibilityAttribute and Type/ReferenceConverters but
can't find a good example on how to actually do this and don't know if this
is what I need.
Also, after it is possible to change the property in the designer, will the
change be saved in the code? I've had previous problems where I could change
the property (when the property class inherits from Component) but the
changes were not saved.
public class UserControl1: UserControl{
public UserControl1(){}
private Border border;
[Browsable(true),
DesignerSerializationVisibilityAttribute(DesignerSerializationVisibilityAttr
ibute.Content]
public Border Border{
get{ return this.border; }
set{
this.border = value;
}
}
}
[DefaultPropertie("Color")]
public class Border{
public Border():this(Color.Black){}
public Border(Color c){
this.Color = c;
}
private Color color;
[Category("Appearance"),
Browsable(true)]
public Color Color{
get{ return this.color; }
set{ this.color = value; }
}
}
thanks.