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

Chapter 7: Application Bar > Wiring Up Events to an Application Bar

Wiring Up Events to an Application Bar

There are two steps to writing code that reacts to Application Bar events:

  1. Writing a small snippet of glue code that links an Application Bar button or menu item click to the function that does all the processing (let's call this function the worker function)
  2. Writing a worker function that performs all the heavy lifting, such as rearranging UI elements on the screen, saving data, prompting the user for input, or anything elsethat the developer decides to do in response to the button or the menu item click event

Let's start with the Add button, which you'll wire up in the next section.

Adding Glue Code and a Worker Function to the Add Button

Visual Studio 2010 has made adding both glue code and a worker function virtually a two-keystroke procedure. Let's see how easy it is to create an eventhandler for the Add button on your Application Bar using a couple of Visual Studio 2010 shortcuts. This demo assumes that you have already created the Application Bar via managed code (not XAML) by following the steps in the “Adding an Application Bar Using Managed Code”section earlier in this chapter.


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint