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

I am new to WPF and now I am using a third-party lib xamChart in my project

earlier in XAML I have a chart, and its axis has Unit, which is an int property and I

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

This works fine, but now I need to create a runtime diagram through the code behind. How can I do this in C #? and FYI all axes .Unit.xxx in C # code do not have what I want, please help, thank you in advance, any suggestion is very appreciated!

FYI code snippet in xaml

 <igCA:Axis AxisType="PrimaryX" AutoRange="True" Unit="{Binding AnotherIntegerProperty, Converter={StaticResource UnitConverter}}"> 
+7
source share
1 answer

Try this by adjusting something different than what you missed to indicate:

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

Greetings

+22
source

All Articles