hi
i was given a solution to enable to re-template the AxisLabel2d controls which worked fine. See attached
When i resize the window, the labels revert back to the defaulted state (timedate), initally it is fine.
My converter does nothing but return a string. I restyle using the code below (as per the suggestion by you guys)
ChartArea area = _CA;
HorizontalAxisLabels2D axisLabelsContainer = area.FindChildByType<HorizontalAxisLabels2D>();
var axisLabels = axisLabelsContainer.ChildrenOfType<AxisLabel2D>();
System.Windows.Style style = _GD.Resources["CustomLabel"] as System.Windows.Style;
foreach (var item in axisLabels)
{
item.Style = style;
}
public class GetTextConverter : IValueConverter, IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
return "I Am HERE";
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return "I Am HERE";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException();}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); }
}
<Style x:Key="CustomLabel" TargetType="telerikCharting:AxisLabel2D">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="telerikCharting:AxisLabel2D">
<Border Background="{TemplateBinding Background}">
<Border.DataContext>
<MultiBinding Converter="{StaticResource GetTextConverter}">
<MultiBinding.Bindings>
<Binding Path="DataContext" ElementName="_GD"/>
<Binding Path="CurrentIndex"/>
</MultiBinding.Bindings>
</MultiBinding>
</Border.DataContext>
<TextBlock Style="{TemplateBinding ItemLabelStyle}" Text="{Binding .}">
<TextBlock.LayoutTransform>
<RotateTransform x:Name="PART_RotateTransform" />
</TextBlock.LayoutTransform>
</TextBlock>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>