开发者

how can I set the converter binding in the C# code?

I am newbie in WPF and now I am using a 3rd party lib xamChart in my project

previously in the XAML i have a Chart and its axis has开发者_JAVA百科 a Unit which is a int property and I have

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

This works perfectly, but now I need to create the chart in the runtime through the code behind. How can I do that in C#? and FYI all the axis.Unit.xxx in the c# code do not have the thing I want, Please help, thank you very much in advance, any suggestion is much appreciated!

FYI code snippet in of xaml

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


Try this by adjusting anything is not correct as you missed to specify:

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

Cheers

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜