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

Is is possible to zoom only without showing the scrollbar?

3 Answers 85 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Pablo
Top achievements
Rank 1
Pablo asked on 07 Sep 2011, 03:48 PM
Hello,

Due to the particular needs of our project, we want the user to be able to zoom over the chart's X Axis but without showing any scrollbar. We would do it using the MouseLeftButtonDown and Up belonging to the plot area, calculating the data points and setting a new RangeEnd and RangeStart for the ZoomSettings object. 

However, right now it is only possible to set ZoomSettings to None, Scroll or ScrollAndZoom. Is there any workaround so that zoom can be made (as described above) but hidding the ScrollBar? If so, could you please provide any code sample?

Thank you very much, 

Pablo.

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 09 Sep 2011, 09:53 AM
Hello Pablo,

Please, consider the following approach :
this.LayoutUpdated += new EventHandler(MainPage_LayoutUpdated);
bool onlyTheFirstTime = false;
       void MainPage_LayoutUpdated(object sender, EventArgs e)
       {
           if (onlyTheFirstTime)
               return;
           onlyTheFirstTime = true;
           var axisContainer = this.ChildrenOfType<Telerik.Windows.Controls.Charting.AxisX2D>()                
               .First();
           foreach (var item in axisContainer.ChildrenOfType<RadSlider>())
               item.Visibility = System.Windows.Visibility.Collapsed;
       }

This way the scrollbar should be collapsed, while still keeping the Zoom&Scroll settings and being able to zoom in/out.

Hope this helps.

Regards,
Nikolay
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Pablo
Top achievements
Rank 1
answered on 09 Sep 2011, 11:24 AM
Hello Nikolay,

Thank you for your response. I'll try this implementation and get back to you with any issue. 

Regards, 

Pablo.
0
Pablo
Top achievements
Rank 1
answered on 12 Sep 2011, 10:41 AM
Hi Nikolay,

It worked. Thank you, that's what we needed!

Regards, 

Pablo.
Tags
Chart
Asked by
Pablo
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Pablo
Top achievements
Rank 1
Share this question
or