Part 3: Add the code
In this step, add code to take action when the user interacts with your app.
Add the code
The final step before testing your app is to add the code that implements the Go button.
To add the code
- In the designer, double-click the Go button control that you added. This creates an empty event handler for the button’s Click event. You will see the empty event handler in a page of C# code on the MainPage.xaml.cs tab, or in a page of Visual Basic code on the MainPage.xaml.vb tab.
When you double-click the Go button, Visual Studio also updates the XAML in MainPage.xaml to connect the button’s Click event to the Go_Click event handler.
<Button x:Name="Go" Content="Go" ... Click="Go_Click"/>
- In MainPage.xaml.cs or MainPage.xaml.vb, add the two lines of code shown below inside the empty Go_Click event handler. This code takes the URL that the user enters in the text box and navigates to that URL in the WebView control named MiniBrowser.
Summary
Congratulations, you're done with the third step of building your first Windows Phone Store app! You learned how to add code to take action when the user interacts with your app.
Next step
In the next step of this tutorial, you run your app on your development computer in Windows Phone emulator. Go to Part 4: Run the app.