C# WinForms中自定义的UserControl属性绑定

C# WinForms中自定义的UserControl属性绑定,c#,winforms,data-binding,C#,Winforms,Data Binding,我有一个定制的用户控件: public class CustomUC : UserControl { [Bindable(true)] private string PropertyX { get { ... } ; set { ... }; } } 我用的是另一种形式。在这个表单上,我使用的是一个数据源 问题是我无法找出如何将这个PropertyX绑定到数据源的某个字段 编辑 我的DataSource是我在设计时创建的System.Windows.Forms.BindSour

我有一个定制的用户控件:

public class CustomUC : UserControl
{
    [Bindable(true)]
    private string PropertyX { get { ... } ; set { ... }; }
}
我用的是另一种形式。在这个表单上,我使用的是一个数据源

问题是我无法找出如何将这个
PropertyX
绑定到数据源的某个字段

编辑


我的
DataSource
是我在设计时创建的
System.Windows.Forms.BindSource
对象。我已将一个类设置为此
数据源
,以便链接到
ClassA
。该类有一个属性
Notes
我想绑定到
custommadeucropertyx

您应该尝试以下方法通过编码绑定属性:

object.DataBindings.Add("PropertyX", YourDataSrouce, "columnname in your datasource")

您可以使用设计器或代码。有什么问题吗?您能指定您指的是哪个
数据源吗?控件(如
按钮)
?你想用这个属性做什么?@rbr94,我刚刚编辑了我的帖子。