Can I bind a chart's EnableZoomingToolBar behaviour?

My users want to be able to show and hide the zooming toolbar using a button.  I would have expected to be able to do this something like :-
<sf:SfChart.Behaviors>
   <sf:ChartZoomPanBehavior EnableZoomingToolBar="{Binding ShowZoomToolbarInCharts}" ToolBarItems="All" EnableSelectionZooming="True" ToolBarOrientation="Horizontal" HorizontalPosition="Right" VerticalPosition="Top" />
</sf:SfChart.Behaviors>

However, that doesn't seem to be working.  I suspect because I haven't set the data context correctly because my ShowZoomToolbarInCharts isn't getting called.  I tried setting the charts data context but that didn't work.  The behaviour itself doesn't appear to have a data context property.

Any suggestions on how I can achieve this?

Thanks



1 Reply 1 reply marked as answer

SJ Suyamburaja Jayakumar Syncfusion Team June 15, 2020 10:34 AM UTC

Hi Declan Hillier, 
 
Greetings from Syncfusion. 
 
We would like to let you know that your requirement has been achieved by the below code snippet 
 
XAML
  <syncfusion:SfChart.Behaviors> 
                <syncfusion:ChartZoomPanBehavior x:Name="chartZoomPanBehavior" EnableZoomingToolBar="{Binding Source={x:Reference viewModel}, Path=ShowZoomToolbarInCharts}" ToolBarItems="All" EnableSelectionZooming="True" ToolBarOrientation="Horizontal" HorizontalPosition="Right" VerticalPosition="Top" /> 
            </syncfusion:SfChart.Behaviors> 
 
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Suyamburaja J. 


Marked as answer
Loader.
Up arrow icon