本文介绍了是什么在C#中的winform相当于UpdateSourceTrigger?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题。什么是C#Windows应用程序相当于UpdateSourceTrigger?

 公共静态无效绑定(组合框中巴,ComboVAlidationRule VLD)
        {
            结合bndControl =新的绑定(的DataBind);
            bndControl.Source = VLD;
            bndControl.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            bndControl.ValidationRules.Add(VLD);
            cmb.SetBinding(ComboBox.SelectedItemProperty,bndControl);
        }


解决方案

Binding.DataSourceUpdateMode 是你要找的东西。

 使用System.Windows.Forms的;// ...    约束力181 =新的绑定(文本,this.personBindingSource,姓名);
    binding.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;    this.nameTextBox.DataBindings.Add(绑定);

I have question. what is equivalent UpdateSourceTrigger in C# windows application?

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);
        }
解决方案

Binding.DataSourceUpdateMode is what you're looking for.

using System.Windows.Forms;

// ...

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

    this.nameTextBox.DataBindings.Add(binding);

这篇关于是什么在C#中的winform相当于UpdateSourceTrigger?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 22:53