How Can I Add a New Command to a Control's Event

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-04-21T10:59:18Z Indexed on 2010/04/21 11:03 UTC
Read the original article Hit count: 300

Filed under:
|

Hi, thanks for taking a look at this question.

I have been building an application (VB/WPF) following Josh Smith's example of an MVVM pattern: Click here to view

My Views have Controls which trigger a Command upon an event, such as a button click and these are bound to properties in the ViewModel.

My ViewModel exposes properties of type ICommand which invoke the appropriate methods.

This has worked well, until now! I now want to use a Thumb Control to allow a user to move an object within a Canvas. I don't believe that the Thumb has a Command capability 'out of the box'. A Thumb raises a 'DragDelta' event when being moved. So my question is as follows:

How do I extend a Control's capability to issue a Command upon an event please?

I wish to issue a new Command, let's say 'onDragDelta' so that I can bind it to a property in my ViewModel just like my Buttons.

Thank you very much

© Stack Overflow or respective owner

Related posts about wpf

Related posts about mvvm