【问题标题】:how can I set the converter binding in the C# code?如何在 C# 代码中设置转换器绑定?
【发布时间】:2011-07-28 10:32:42
【问题描述】:

我是 WPF 的新手,现在我在我的项目中使用 3rd 方库 xamChart

以前在 XAML 中我有一个图表,它的轴有一个 Unit,它是一个 int 属性 我有

Unit="{Binding NextStartRow, Converter={StaticResource UnitConverter}}"

这很好用,但现在我需要通过后面的代码在运行时创建图表。 我怎么能在 C# 中做到这一点?仅供参考,c#代码中的所有axis.Unit.xxx都没有我想要的东西,请帮助,非常感谢您,任何建议都非常感谢!

xaml 中的 FYI 代码 sn-p

<igCA:Axis AxisType="PrimaryX" AutoRange="True"  
           Unit="{Binding AnotherIntegerProperty, Converter={StaticResource UnitConverter}}">

【问题讨论】:

    标签: wpf data-binding wpftoolkit


    【解决方案1】:

    通过调整任何不正确的内容来尝试此操作,因为您错过了指定:

    myXamChart.SetBinding(
      Unit,
      new Binding("AnotherIntegerProperty")
      {
        Converter = new UnitConverter()
      });
    

    干杯

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-23
      • 1970-01-01
      • 1970-01-01
      • 2010-10-29
      • 1970-01-01
      • 2016-12-01
      • 2012-10-14
      • 1970-01-01
      相关资源
      最近更新 更多