C# 如何将字符串属性绑定到ToolStripTextBox?
我认为,我的问题根源于这样一个事实:C# 如何将字符串属性绑定到ToolStripTextBox?,c#,winforms,data-binding,C#,Winforms,Data Binding,我认为,我的问题根源于这样一个事实:TextBox是IBindableComponent,而ToolStripTextBox不是 我希望使用ToolStripTextBox进行简单绑定,如答案中所述 目前我正在这样做: public string SendToEmail { get{ return _sendToEmail.Text; } set { _sendToEmail.Text = value; } } 所以现在我得到了双向同步,但它不是松散耦合的 问题:是否有一个.N
TextBox
是IBindableComponent
,而ToolStripTextBox
不是
我希望使用ToolStripTextBox
进行简单绑定,如答案中所述
目前我正在这样做:
public string SendToEmail {
get{
return _sendToEmail.Text;
}
set {
_sendToEmail.Text = value;
}
}
所以现在我得到了双向同步,但它不是松散耦合的
问题:是否有一个.NET类封装属性的名称两个类并监视单向或双向的更改(使用反射?)?或者有更简单的方法来考虑它吗?使用ToolStripTextBox的TextBox属性进行数据绑定。这是一个完整的文本框控件,允许您访问所需的数据绑定
// this is NOT the same code as above, note the TextBox property in use.
this.toolStripTextBox1.TextBox.DataBindings.Add(...);
// this is NOT the same code as above, note the TextBox property in use.
this.toolStripTextBox1.TextBox.DataBindings.Add(...);