This is a migrated thread and some comments may be shown as answers.

Binding property for label style's margin

1 Answer 502 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Trump
Top achievements
Rank 1
Trump asked on 12 Dec 2017, 12:57 AM

Right now I set up the label's margin in xaml

<telerik:RadCartesianChart.HorizontalAxis>
                <telerik:CategoricalAxis MajorTickLength="0" LineStroke="Transparent">
                      <telerik:CategoricalAxis.LabelStyle>
                           <Style TargetType="TextBlock">
                                <Setter Property="Margin" Value="20 10 15 20" />
                           </Style>
                      </telerik:CategoricalAxis.LabelStyle>
                </telerik:CategoricalAxis.LabelStyle>
</telerik:RadCartesianChart.HorizontalAxis>

But I want to use property binding, so I created the property in View Model. The type of property is Thickness. But it is not working. I doubt that CategoricalAxis doesn't support it because I saw an example.

Thanks for advice.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dilyan Traykov
Telerik team
answered on 13 Dec 2017, 01:06 PM
Hello,

To achieve the desired result you will need to set the ClipToBounds property of the RadCartesianChart to False, and add a bottom margin to it with the value of the label's bottom and top margins combined. This is required as the control will not take into account these margins when they are set trough a binding as it is evaluated too late.

I'm attaching a small sample project to better demonstrate what I have in mind. Please let me know whether such an approach would work for you.

Regards,
Dilyan Traykov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ChartView
Asked by
Trump
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or