Part 3: Add the code
Collapse the table of content
Expand the table of content

Part 3: Add the code

[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]

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.

Dn631253.wedge(en-us,WIN.10).gifTo add the code

  1. 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.
    No code example is currently available or this language may not be supported.

    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"/>
    
    
  2. 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.
    No code example is currently available or this language may not be supported.

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.

 

 

Show:
© 2017 Microsoft