Home Screen :

Name of Experiment : Basic Html on Windows Phone

Exp No : WAP1

Background : Student should have basic knowledge of C#.

Summary : HTML (Hyper Text Markup Language) is a markup language used on the World Wide Web. It provides the basic skeleton for different web pages on the internet.

Learning Objective : To learn the basic steps in order to run the html file over the Windows Phone using Web Browser control.


Target Platform : This experiment is tested on Windows Phone Emulator and Nokia Lumia 800.



Source Code : Comments :
<Grid x:Name="LayoutRoot" Background="Transparent">
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>

<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ExperimentTitle" Text="ExpNo:WAP1" TextAlignment="Right" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="ApplicationTitle" Text="WAP Programing" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Basic HTML" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> </StackPanel>

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

<phone:WebBrowser HorizontalAlignment="Left" Margin="10,73,0,0" Name="webBrowser1" VerticalAlignment="Top" Width="440" Height="528" />
<Button Content="Load HTML" Height="72" HorizontalAlignment="Left" Margin="-4,10,0,0" x:Name="btnLoadHTML" VerticalAlignment="Top" Width="200" FontSize="28" FontWeight="Bold" FontFamily="Calibri" Click="btnLoadHTML_Click" >

 ExpNo:WAP1(Experiment Title)
 WAP Programing( Application Title)
 Basic HTML (PageTitle)

 Web Browser

 Button(Load HTML)

using System;
using System.Windows;
using Microsoft.Phone.Controls;
using System.IO.IsolatedStorage;
using System.IO;
using System.Windows.Resources;

namespace Hello_Xhtml
public partial class MainPage : PhoneApplicationPage


// Constructor
public MainPage()

// This Function is use to read the file from Isolated Storage
private void SaveHTMLFile()
string fileName = "First.htm";
IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication();
if (isolatedStorageFile.FileExists(fileName) == true)
StreamResourceInfo streamResourceInfo = Application.GetResourceStream(new Uri(fileName, UriKind.Relative));
using (BinaryReader binaryReader = new BinaryReader(streamResourceInfo.Stream))
{byte[] data = binaryReader.ReadBytes((int)streamResourceInfo.Stream.Length);
using (BinaryWriter bw = new BinaryWriter(isolatedStorageFile.CreateFile(fileName)))
{ bw.Write(data);
// Button Event handler
private void btnLoadHTML_Click(object sender, RoutedEventArgs e)
{ SaveHTMLFile();
webBrowser1.Navigate(new Uri("First.htm",UriKind.Relative));

 Read and Write the File Through Isolated Storage.

 Directly call the file through the Navigate Method.
<title>This page shows how to embed HTML Content in WP7</title>
<h1>Hi Student!! </h1>

 HTML Code



Observation : It should be noted by developer that for any kind of WP7 application, steps (1-6) need to be repeated.

Video Link

For Windows Phone


Right Click Here And Select Save Target For Entire Download :

Basic Html on Windows Phone