Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / usercontrol properties not being saved to the windows form designer

usercontrol properties not being saved to the windows form designer

New Discussion
Ryan
Ryan asked on Nov 26, 2008 4:57 AM

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

{get {return MyTextBox; }

}

 

public ComboBox MyComboBox

{

get {return MyComboBox;}

}

}

 

Sign In to post a reply

Replies

  • 0
    Amiram Korach
    Amiram Korach answered on Nov 26, 2008 4:57 AM

    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.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Ryan
Favorites
0
Replies
1
Created On
Nov 26, 2008
Last Post
17 years, 3 months ago

Suggested Discussions

Created by

Created on

Nov 26, 2008 4:57 AM

Last activity on

Feb 19, 2026 9:46 PM