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 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}}">
You can't bind a converter parameter because it's not a dependency property but you could use multi binding to do that: Lead Software Engineer -... Efforts may fail but don't fail to take effort -------------- sidd What markup do you have, what code for your converter and what is the expected result? Hope that helps.
The following example demonstrates how to use this value converter in a data binding: In this example, the IntToBoolConverter is instantiated in the page's resource dictionary. It's then referenced with a StaticResource markup extension to set the Converter property in two data bindings.
This class becomes part of the data binding. The Convert method is called when data moves from the source to the target in OneWay or TwoWay bindings. The value parameter is the object or value from the data-binding source. The method must return a value of the type of the data-binding target.
My understanding is : 'ConverterParameter is not a dependency property and it's not bindable'. {"A 'Binding' cannot be set on the 'ConverterParameter' property of type 'Binding'.
Try this by adjusting anything is not correct as you missed to specify:
myXamChart.SetBinding(
Unit,
new Binding("AnotherIntegerProperty")
{
Converter = new UnitConverter()
});
Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With