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

CTRL + MouseScroll for Zoom, MouseScroll for Scrolling

5 Answers 692 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Semih
Top achievements
Rank 1
Semih asked on 16 Dec 2014, 06:47 AM
Hi,

I want to scroll through the Diagram using MouseScroll and do the zoom operation by holding CTRL key and use mouse scroll up/down. By default MouseScroll  does the zoom operations. I want to perform zooming by holding a CTRL modifier and MouseScroll. Is this possible?

Regards,

5 Answers, 1 is accepted

Sort by
0
Accepted
Milena
Telerik team
answered on 17 Dec 2014, 08:31 AM
Hello Semih,

Let me get straight to your questions. So, to achieve your requirements: 
1) Zoom operation - you can subscribe to the diagram's PreviewZoom event and check if the Ctrl key is down, if not, you can cancel the zoom operation by setting the event arguments' Handled property to True.
2) Scroll operation - you can use the diagram's MouseWheel event and change the diagram's Y position with the e.Delta. 

For your convenience I implemented this approach in the attached project. Please take a look at it and let us know if it works for you

Regards,
Milena
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Dinesh
Top achievements
Rank 1
answered on 07 Feb 2019, 05:55 AM
I just need some help on how to scroll HORIZONTALLY by using (SHIFT + MOUSE SCROLL) IN WPF application.
0
Vladimir Stoyanov
Telerik team
answered on 11 Feb 2019, 11:18 AM
Hello Dinesh,

I am attaching a sample project demonstrating how the desired requirement can be achieved with a native ListBox by handling the PreviewMouseWheel event. Please, check it out and let me know if it helps.

Additionally, since I noticed that you have written in several forum threads, may I kindly ask you to stick to a single thread which topic is close to your scenario? If there isn't one, you can open a separate forum thread. This will allow us to better organize our communication. 

Thank you in advance for your understanding.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Shanthosh
Top achievements
Rank 1
answered on 11 Feb 2019, 12:27 PM

same code i was already tried but childrenoftype<ScrollViewer>() shows the error..

it shows assembly reference missing..

 

my code:

 var scrollviewr = this.radGridViewRoomsSummary.ChildrenOfType<ScrollViewer>.FirstOrDefault();

error : SeverityCodeDescriptionProjectFileLineSuppression State
ErrorCS0119'ChildrenOfTypeExtensions.ChildrenOfType<T>(DependencyObject)' is a method, which is not valid in the given contextHeatTransferE:\......\View\RoomsSummaryDetails.xaml.cs95Active

0
Vladimir Stoyanov
Telerik team
answered on 13 Feb 2019, 02:22 PM
Hello Shanthosh,

Note, that the ChidlrenOfType extension method is defined in the Telerik.Windows.Controls dll and you need to reference it in order to use it.

Although I am uncertain why the mentioned error is received on your end, you can check out the following resource which I found while searching for it on the net:
Is a 'method' which is not valid in the given context error

If the above information does not help, note that the ChildrenOfType extension method only searches for the children of a specific element of a given type. You can also implement this logic. Here is a thread, where a similar topic was discussed:
Find all controls in WPF Window by type

Hope you find this helpful.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Diagram
Asked by
Semih
Top achievements
Rank 1
Answers by
Milena
Telerik team
Dinesh
Top achievements
Rank 1
Vladimir Stoyanov
Telerik team
Shanthosh
Top achievements
Rank 1
Share this question
or