Hello,
For CategoryXAxis everything works OK:
<ig:CategoryXAxis x:Name="XAxis" ItemsSource="{Binding Data}" DateTimeMemberPath="X" Label="{}{X}"> <ig:CategoryXAxis.LabelSettings> <ig:AxisLabelSettings> <ig:AxisLabelSettings.Visibility> <Binding Path="IsAxis1Visible" Mode="OneWay"> <Binding.Converter> <common:AxisVisibilityConverter/> </Binding.Converter> </Binding> </ig:AxisLabelSettings.Visibility> </ig:AxisLabelSettings> </ig:CategoryXAxis.LabelSettings></ig:CategoryXAxis>
but not for:
<ig:CategoryDateTimeXAxis x:Name="XAxis" ItemsSource="{Binding Data}" DateTimeMemberPath="X" Label="{}{X}"> <ig:CategoryDateTimeXAxis.LabelSettings> <ig:AxisLabelSettings> <ig:AxisLabelSettings.Visibility> <Binding Path="IsAxis1Visible" Mode="OneWay"> <Binding.Converter> <common:AxisVisibilityConverter/> </Binding.Converter> </Binding> </ig:AxisLabelSettings.Visibility> </ig:AxisLabelSettings> </ig:CategoryDateTimeXAxis.LabelSettings></ig:CategoryDateTimeXAxis>
When I set it explicitly it works too:
<ig:CategoryDateTimeXAxis x:Name="XAxis" ItemsSource="{Binding Data}" DateTimeMemberPath="X" Label="{}{X}"> <ig:CategoryDateTimeXAxis.LabelSettings> <ig:AxisLabelSettings> <ig:AxisLabelSettings.Visibility> <Visibility>Collapsed</Visibility> </ig:AxisLabelSettings.Visibility> </ig:AxisLabelSettings> </ig:CategoryDateTimeXAxis.LabelSettings></ig:CategoryDateTimeXAxis>
Converter:
[ValueConversion(typeof(bool), typeof(Visibility))] public class AxisVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { try { var active = (bool)value; if (active) return Visibility.Visible; return Visibility.Collapsed; } catch { return Visibility.Collapsed; } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { try { var visibility = (Visibility)value; switch (visibility) { case Visibility.Visible: return true; default: return false; } } catch { return false; } } }
Hello Dmitry,
Thank you for your post. I have logged this behavior with our developers in our tracking system, with an issue ID of 187413. I have also created a support ticket on your behalf with number CAS-149571-L4Y9K3 in order to link the development issue to it so that you are automatically updated when a Service Release containing your fix is available for download.
Sincerely,
Krasimir, MCPD
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support
OK, thank you.
Hi Dmitry,
I received a response from our development team and it seems to be a binding issue. It is not an issue with the code of the axis or the chart. Sometime when the DataContext is set after InitializeComponent() is called, WPF framework cannot resolve the DataContext of sub elements and binding does not work.
You can try to set Datacontext before the InitializeComponent() is called
DataContext = new DataViewModel();
InitializeComponent();
Let me know, if you need any further assistance on this matter.
to clarify, you should not have to do that, technically. but some combination of factors is fouling up the Data context inheritance for the label settings specifically for the date time axis. However after much digging , there doesn't appear to be a a salient difference code-wise between how the label settings are set up between date time axis vs normal category, so we are reporting this to Microsoft. Yanko is proposing a work around for you to use.