Text property in a UserControl in C#

前端 未结 3 1226
既然无缘
既然无缘 2020-11-30 05:46

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 thin

3条回答
  •  春和景丽
    2020-11-30 06:16

    Reflector is a crucial tool for a .NET developer. It is immediately obvious what you need to do when you use it to look at the UserControl.Text property:

    [Bindable(false), EditorBrowsable(EditorBrowsableState.Never), Browsable(false),
     DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    public override string Text
    {
        get
        {
            return base.Text;
        }
        set
        {
            base.Text = value;
        }
    }
    

    Ho showed you what you need to do to cancel these attributes, too bad he didn't show you how he found out. Reflector is was free, download it from redgate.com or check the alternatives here : Something Better than .NET Reflector?

提交回复
热议问题