Pre loader

Change TickLabelStyle.FontSize

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums


Hi There!

I created a UserControl that contains amongst other stuff a SciChartSurface. That control can be resized by the user to any size and is together with a lot of other stuff in a grid. The user can create a PDF of the whole whole grid using RenderTargetBitmap.

For the PDF the grid is resized by a factor x to get a higher resolution. All children of that grid are repostioned and so on and it all works. The Chart looking really good in the PDF, but the TickLabels are not resizing when changing the FontSize of their axis.

I tried to bind the FontSize in the TickLabelStyle to the Axis FontSize in XAML and tried to set the binding in code behind but I can’t get it to work.

Anyone got an idea how to set TickLabelStyle.FontSize the same as its axis FontSize?

UPDATE: Manged to set a binding in the TickLabelStyle to the upper NumericAxis, but now I have the tick labels font size changing itself between the new and old font size all the time until I it change back to the old font size.

Thanks for any help!

  • You must to post comments

Hi there

Seems that RelativeSource and ElementName binding doesn’t work for all labels if try to use it in TickLabelStyle. Some of ticks are successfuly bounded but some of them don’t because binding can’t locate source. The strange behavior of axis ticks labels caused by reusing of ticklabels during redrawing of chart. Chart doesn’t create new labels unless it’s necessary so style and binding expression remains the same for all of them.

To woraround I created static resource and used it to bind font size( this can be some property in view model locator or something else) and everything works:

 <Style TargetType="sciChart:AxisBase" x:Key="NumericAxisStyle">
        <Setter Property="TickLabelStyle">
                <Style TargetType="sciChart:NumericTickLabel">
                    <Setter Property="FontSize" Value="{Binding Source={StaticResource FontVm}, Path=Font}"/>

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.