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 Events

Creating Routed Events

Unfortunately, Visual Studio doesn’t include a snippet for creating routed events (probably because you’ll do it a lot less frequently). But the steps are similar to creating a dependency property, which you already know how to do, and none is particularly difficult. Here’s the process in detail:

1 CREATE THE EVENTARGS CLASS, IF NECESSARY

Many events can use RoutedEventArgs or one of its descendants, but if you need to pass additional information to the methods that respond to your events, you’ll need to create your own argument class. The class can be defined independently or nested within the class that declares the event, which is convenient if you won’t be using it elsewhere. In either case, the class should be public.


  

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


 Â