1

我有问题。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);
        }
4

1 回答 1

1

Binding.DataSourceUpdateMode就是你要找的。

using System.Windows.Forms;

// ...

    Binding binding = new Binding("Text", this.personBindingSource, "Name");
    binding.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;

    this.nameTextBox.DataBindings.Add(binding);
于 2012-11-10T10:48:40.067 回答