Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

18. WPF Interactions > Creating Routed Commands

Creating Routed Commands

Because routed commands are first-class elements of the Framework rather than wrappers for CLR objects, they’re much easier to create than dependency properties or routed events. In fact, they don’t require any techniques you don’t know already. But you do need to make some design decisions:

Where Should the Command be Defined?

While it’s possible to implement a new command type, usually you’ll create an instance of RoutedCommand or RoutedUICommand as a public static property. But a property of which class?

Should Gestures be Associated with the Command?

If you’re defining your own commands, you’ll need to decide whether a gesture should be associated with the command (they’re optional), and if so, what that gesture should be. Be careful not to step on any of the Windows conventions. If you redefine Ctrl+C to close the application instead of copy text, you’re going to confuse people.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial