我有一个自定义控件(Windows窗体),它是一个查找文本框.Control上的属性是Current Selection,它是包含"Identifier","Code"和"Description"的自定义对象.此属性是使用BindingSource的Databound.
显示信息非常有效.另一方面,无论我将Update设置为OnValidate还是OnValueChange,它都不会更新BindingSource.是否有一些我不想让它自动更新?
private System.Windows.Forms.BindingSource buildPlanComponentDataBindingSource;
public void LoadBuildPlan(string itemNumber)
{
var buildPlanComponents = BuildPlan.LoadBuildPlanComponents(itemNumber, AutomaticPrice);
buildPlanComponentDataBindingSource.DataSource = buildPlanComponents;
AssemblyNumber = itemNumber;
}
[Bindable(true)]
[DefaultValue(null)]
public ILookupSelection CurrentSelection
{
get
{
if (currentSelection == null)
currentSelection = new LookupSelection {Code = txtLookup.Text};
return currentSelection;
}
set
{
if (value == null) return;
currentSelection = value;
SetText(currentSelection, DisplayText);
SetDescription(currentSelection, DisplayDescription);
}
}
Run Code Online (Sandbox Code Playgroud)