У меня есть пользовательский элемент управления (форма Windows), который представляет собой текстовое поле поиска. Свойством в элементе управления является Current Selection, который представляет собой пользовательский объект, содержащий «Identifier», «Code» и «Description». Это свойство привязано к данным с использованием BindingSource.
Отображение информации прекрасно работает. С другой стороны, независимо от того, установлен ли для параметра «Обновление» значение 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);
}
}