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!
- David Struthers asked 10 years ago
- last edited 10 years ago
- You must login 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">
<Setter.Value>
<Style TargetType="sciChart:NumericTickLabel">
<Setter Property="FontSize" Value="{Binding Source={StaticResource FontVm}, Path=Font}"/>
</Style>
</Setter.Value>
</Setter>
</Style>
Best regards,
Yura
- Yura Khariton answered 10 years ago
- You must login to post comments
Please login first to submit.