We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Disable parent ScrollViewer when scrolling in SfChart

Hello,

I'm using a SfChart which is embedded in a ScrollViewer. The SfChart has Zoom Behavior enabled like this:

<sfchart:ChartZoomPanBehavior ResetOnDoubleTap="True" EnableMouseWheelZooming="True" EnablePinchZooming="True" ZoomRelativeToCursor="True" ZoomMode="X"/>

I noticed, that when I'm zoom-scrolling in the SfChart, the ScrollViewer also scrolled up and down.
Is there a possibility to disable the ScrollViewer while the mouse is active within the SfChart?

Greetings
Alexander

3 Replies

MK Muneesh Kumar G Syncfusion Team March 25, 2019 05:56 AM UTC

Hi Alexander,   
 
Greetings from Syncfusion, we have analyzed your required requirement and you can achieve this by raising PointerWheelChanged event in SfChart and set e.Handled as true as per the below code snippet.  
 
Code snippet 
  <ScrollViewer > 
            <StackPanel> 
                 
            <chart:SfChart x:Name="chart1" Height="600" Margin="50,5,50,5" PointerWheelChanged="ScrollViewer_PointerWheelChanged"> 
             
.. 
        </chart:SfChart> 
 
                <chart:SfChart x:Name="chart2" Height="600" Margin="50,5,50,5" PointerWheelChanged="ScrollViewer_PointerWheelChanged"> 
 
                    .. 
                </chart:SfChart> 
 
 
            </StackPanel> 
        </ScrollViewer> 
 
public sealed partial class MainPage : Page 
    { 
        public MainPage() 
        { 
            this.InitializeComponent(); 
        } 
 
        private void ScrollViewer_PointerWheelChanged(object sender, PointerRoutedEventArgs e) 
        { 
            e.Handled = true; 
        } 
    } 
 
We have prepared a sample based on this, please find the sample from the following location.  
 
 
Please let us know if you have any queries.  
 
Thanks,  
Muneesh Kumar G.  
 



AL Alexander March 25, 2019 10:07 AM UTC

Thank you very much, this worked.


MK Muneesh Kumar G Syncfusion Team March 25, 2019 10:28 AM UTC

Hi Alexander,   
 
Thanks for the update. 
  
We are glad to know that the given solution works. Please let us know if you need any further assistance. 
 
Thanks,  
Muneesh Kumar G.  
 


Loader.
Live Chat Icon For mobile
Up arrow icon