I have a control with a inner TextBox. I want to make a direct relationship between the Text property of the UserControl and the Text property of the TextBox. The first thing I realized is that Text was not being displayed in the Properties of the UserControl. Then I added the Browsable(true) attribute.
[Browsable(true)] public override string Text { get { return m_textBox.Text; } set { m_textBox.Text = value; } }
Now, the text will be shown for a while, but then is deleted. This is because the information is not written automatically within the xxxx.Designer.cs
file. How can this behviour be changed?
User Control properties are used to set the values of a User Control from the parent page.
Remarks. Use the Text property to specify or determine the text content of the Label control. This property is commonly used to programmatically customize the text that is displayed in the Label control.
You need more attributes:
[EditorBrowsable(EditorBrowsableState.Always)] [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] [Bindable(true)] public override string Text { get; set; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With