【问题标题】:Why is a TypeConverterAttribute not used in DataBinding?为什么 DataBinding 中不使用 TypeConverterAttribute?
【发布时间】:2020-04-11 00:56:27
【问题描述】:

我花了大约一天的时间试图弄清楚为什么一个特定的类没有使用其属性上标记的 TypeConverters。

事实证明,这不是类本身,而是我为通常使用扩展方法的 UI 创建了手动数据绑定。

因此,在您追求“AssemblyResolve”或“使用类型名称而不是 typeof”之前,如果您的问题涉及数据绑定,请检查一下。

【问题讨论】:

    标签: .net winforms data-binding typeconverter


    【解决方案1】:
    txt.DataBindings.Add(nameof(txt.Text), source, propertyName, true, DataSourceUpdateMode.OnValidation, null, format);  //WORKS
    txt.DataBindings.Add(nameof(txt.Text), source, propertyName, false, DataSourceUpdateMode.OnValidation, null, format);  //fails
    txt.DataBindings.Add(nameof(txt.Text), source, propertyName);  //fails
    

    那里的真/假标志?

    那是“formattingEnabled”。

    【讨论】:

      猜你喜欢
      • 2020-02-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-26
      • 2023-01-19
      • 1970-01-01
      相关资源
      最近更新 更多