Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In a user control I have a property Text Text with definition as follows :
C#
string text;
[Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
public override string Text
{
    get
    {
        return text;
    }
    set
    {
        this.text = value;
        this.Invalidate();
    }
}

I added this usercontrol to a form and edited the Text property in the Properties tab.
When I do this the usercontrol shows the new text on it.
Then when I run it , the usercontrol does not have any text , just nothing.

What I have tried:

I have tried adding
C#
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]

along with
C#
[Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
Posted
Updated 4-Nov-16 1:25am

1 solution

I just found the solution.
For those who stumble on this page the solution is given below :
C#
string text;
[EditorBrowsable(EditorBrowsableState.Always)]
[Browsable(true)]	[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Bindable(true)]
public override string Text
{
    get
    {
        return text;
    }
    set
    {
        this.text = value;
        this.Invalidate();
    }
}
 
Share this answer
 
Comments
#realJSOP 4-Nov-16 7:30am    
If this is the solution to your problem, mark it as the answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900