Part 4: Complete 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 ]
This topic provides the complete code sample used in the tutorial Part 4: Run the app.
Important This tutorial is intended for use with Microsoft Visual Studio 2013 and Windows Phone 8.1. It will not work correctly with earlier versions of Microsoft Visual Studio and Windows Phone.
This topic contains these sections:
- Technologies
- Requirements
- View the code (XAML)
Download location
This sample is not available for download.
Technologies
Programming languages | C# |
Programming models | Windows Runtime |
Requirements
Minimum supported client | None supported |
Minimum supported server | None supported |
Minimum required SDK | Microsoft Visual Studio Express 2013 Update 2 for Windows |
View the code (XAML)
App.xaml
App.xaml contains only generated code.
App.xaml.cs/vb
App.xaml.cs contains only generated code.
MainPage.xaml
<Page
x:Class="MiniBrowser.MainPage"
xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MiniBrowser"
xmlns:d="https://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBlock Margin="10,10,10,0" TextWrapping="Wrap" Text="MiniBrowser" VerticalAlignment="Top" FontSize="48"/>
<TextBox x:Name="URL" Margin="10,95,124,0" Text="https://windows.microsoft.com/" VerticalAlignment="Top"/>
<Button x:Name="Go" Content="Go" HorizontalAlignment="Right" Margin="0,85,10,0" VerticalAlignment="Top" Width="109"/>
<WebView x:Name="MiniBrowser" Margin="10,150,10,10"/>
</Grid>
</Page>
MainPage.xaml.cs/vb
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/p/?LinkID=234238
namespace MiniBrowser
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void Go_Click(object sender, RoutedEventArgs e)
{
}
}
}
Imports System.Runtime.InteropServices.WindowsRuntime
' The Blank Page item template is documented at https://go.microsoft.com/fwlink/p/?LinkID=234238
''' <summary>
''' An empty page that can be used on its own or navigated to within a Frame.
''' </summary>
Public NotInheritable Class MainPage
Inherits Page
''' <summary>
''' Invoked when this page is about to be displayed in a Frame.
''' </summary>
''' <param name="e">Event data that describes how this page was reached. The Parameter
''' property is typically used to configure the page.</param>
Protected Overrides Sub OnNavigatedTo(e As Navigation.NavigationEventArgs)
End Sub
Private Sub Go_Click(sender As Object, e As RoutedEventArgs) Handles Go.Click
End Sub
End Class