我有疑问。什么是C#windows应用程序中的等效UpdateSourceTrigger?
public static void Bind(ComboBox cmb, ComboVAlidationRule vld)
{
Binding bndControl = new Binding("DataBind");
bndControl.Source = vld;
bndControl.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
bndControl.ValidationRules.Add(vld);
cmb.SetBinding(ComboBox.SelectedItemProperty, bndControl);
}
答案 0 :(得分:1)
Binding.DataSourceUpdateMode
正是您要找的。 p>
using System.Windows.Forms;
// ...
Binding binding = new Binding("Text", this.personBindingSource, "Name");
binding.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;
this.nameTextBox.DataBindings.Add(binding);