Hello!
I am trying to bind the format of the Y axis so that depending on a selection on the viewmodel, the Axis format updates, based on a given culture.
So far the code looks like this :
<igCA:Axis AxisType="PrimaryY" Language="{Binding CurrencyFormat, Mode=TwoWay}"> <igCA:Axis.Label> <igCA:Label Format="{}{0:c}" /> </igCA:Axis.Label> </igCA:Axis>
and CurrencyFormat is defined on the ViewModel thusly:
private XmlLanguage _currencyFormat;
public XmlLanguage CurrencyFormat
{ get { return _currencyFormat; } set { if (value != _currencyFormat) { _currencyFormat = value; OnPropertyChanged("CurrencyFormat"); } } }
And instantiated with:
CurrencyFormat = XmlLanguage.GetLanguage(new CultureInfo("en-GB").Name);
This initial Binding works fine, but when changing the CurrencyFormat, the Chart doesnt update.
Any suggestions?
Thanks,
Ok after further testing, changing the Language attribute directly does not update the Currency shown, so Binding this property will definitely not work... Is there any way then to change the culture context of the control with Binding?
Hello ,
I suggest you to use xamDataChart instead of xamChart, because xamChart is retired component. On the following link you could find more information about “Product Changes and Control Retirements in 2011.2 ”
http://ko.infragistics.com/community/blogs/jason_beres/archive/2011/11/10/important-product-changes-and-control-retirements-in-2011-2.aspx
Using xamDataChart you could set Language property of xamDataChart and to use DatatTemplete for the axis label in order to format the label based on the language. So the xaml will looks like:
<ig:XamDataChart HorizontalAlignment="Left" Margin="12,0,0,0" Name="xamDataChart1" VerticalAlignment="Top" Height="337" Width="454" Language="{Binding CurrentLanguage}">
<ig:XamDataChart.Axes>
<ig:NumericXAxis x:Name="xAxis" >
<ig:NumericXAxis.Label>
<DataTemplate>
<TextBlock Text="{Binding Path=Item, StringFormat=C}" />
</DataTemplate>
</ig:NumericXAxis.Label>
….
</ig:XamDataChart>
Also I have created a small sample in order to demonstrate you this approach. Please run the sample and select a language from the combo and see how the labels of X axis are reformatted.
Please let me know if you have any further question.