I have a user control which contains 2 infragistics control (combobox and a textbox) I have 2 properties on my user control which expose these controls. The issue I'm have is when I change a property on the control such as appearance.forecolor in the propeties window and save the form and open the form back up the property value is not saved. How do i get the property value to save in the designer am i missging an attribute?
john
public TextBox MyTextBox
}
{
To fix this issue you need to add an attribute to your properties:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
But, I think you're using a UserControl in the wrong way. A UserControl should follow the encasulation rules and not expose its internal objects (what happens if you set the TextBox to null?), so expose only the properties you need, for example:
exposing a label text in the head of the control.
public string HeaderText
get { return lblHeader.Text;}
set { lblHeader.Text = value; }
To set the font of all controls in the UserControl, just change the UserControl font and it will effect all its children font.