如何在c#代码中设置转换器绑定



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

之前在XAML中我有一个图表,它的轴有一个单位,这是一个int属性我有

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

这可以完美地工作,但是现在我需要通过后面的代码在运行时创建图表。我如何在c#中做到这一点?并且仅供参考所有的axis.Unit.xxx在c#代码中没有我想要的东西,请帮忙,提前非常感谢,任何建议都非常感谢!

xaml的代码片段

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

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

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

欢呼

最新更新