---
title: "WebBrowser Control in Windows 7 Phone Development"  
description: "The most obvious reason to use the WebBrowser control is to display web content within the page of a Windows Phone 7 application. For instance, you ma"  
author: "Anonymous User"  
published: 2012-04-14  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/922/webbrowser-control-in-windows-7-phone-development  
category: "windows phone"  
tags: ["windows phone"]  
reading_time: 2 minutes  

---

# WebBrowser Control in Windows 7 Phone Development

The most obvious reason to use the **WebBrowser** control is to display [web content](https://www.mindstick.com/blog/303211/explore-the-web-content-accessibility-guidelines-wcag-2-1) within the page of a Windows Phone 7 application. For [instance](https://www.mindstick.com/forum/155658/testing-connection-to-cloud-sql-instance-with-a-mysql-client-from-vm-instance), you may be developing an application that shows Twitter feeds in a portion of the screen. The easiest way to do this would be to create a **WebBrowser** control in the application and navigate to a given Twitter page from within that control.\

This article is going to explain how to use **WebBrowser** control in Windows 7 phone development. Let’s see a brief demonstration on it.

##### Getting started:

1. Open [Visual Studio](https://www.mindstick.com/articles/12378/visual-studio-for-mac-is-out-of-beta-preview-now-officially-available)

2. Create new [Silverlight](https://www.mindstick.com/blog/54/silverlight-in-asp-dot-net) Windows 7 Phone [Development Project](https://www.mindstick.com/blog/11637/how-to-choose-the-right-web-designer-for-your-web-design-development-project)

3. Enter [your project](https://www.mindstick.com/forum/156583/best-way-to-link-bootstrap-file-in-your-project) Name

4. Click on button ‘Ok’

![WebBrowser Control in Windows 7 Phone Development](https://www.mindstick.com/mindstickarticle/e5957dee-a494-47da-9cd5-61fb870c02e2/images/cc1dd3db-236f-4472-9d99-f890ccdb2395.png)

Now drag and drop WebBrowser control in ‘MainPage.xaml’ design interface and set some properties of WebBrowser control.

![WebBrowser Control in Windows 7 Phone Development](https://www.mindstick.com/mindstickarticle/e5957dee-a494-47da-9cd5-61fb870c02e2/images/04a16b1d-e846-496b-af08-57554061c777.png)

Now write down the following to code to build up above layout.

##### Code of MainPage.xaml:

```
<!--LayoutRoot is the root grid where all page content is placed-->    <Grid x:Name="LayoutRoot" Background="Transparent">        <Grid.RowDefinitions>            <RowDefinition Height="Auto"/>            <RowDefinition Height="*"/>        </Grid.RowDefinitions>         <!--TitlePanel contains the name of the application and page title-->        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">            <TextBlock x:Name="ApplicationTitle" Text="My Application" Style="{StaticResource PhoneTextNormalStyle}"/>            <TextBlock x:Name="PageTitle" Text="WebBrowser Demo" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" FontSize="40" />        </StackPanel>         <!--ContentPanel - place additional content here-->        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">            <phone:WebBrowser HorizontalAlignment="Left" Margin="0,74,0,0" Name="webBrowser1" VerticalAlignment="Top" Background="#FF64E5E5" DataContext="{Binding}" Height="603" Width="456" AllowDrop="False" />            <Button Content="Go" Height="72" HorizontalAlignment="Left" Margin="348,6,0,0" Name="btnGo" VerticalAlignment="Top" Width="102" FontSize="22" Click="btnGo_Click" />            <TextBox Height="72" HorizontalAlignment="Left" Margin="6,6,0,0" Name="txtSearch" Text="" VerticalAlignment="Top" Width="336" />        </Grid>    </Grid>
```

Code of MainPage.xaml.cs:

```
using System;using System.Windows;using Microsoft.Phone.Controls; namespace webBrowserDemo{    public partial class MainPage : PhoneApplicationPage    {        // Constructor        public MainPage()        {            InitializeComponent();        }         private void btnGo_Click(objectsender, RoutedEventArgse)        {            string strUri=txtSearch.Text;            webBrowser1.Source=new Uri(strUri, UriKind.Absolute);            webBrowser1.Visibility=System.Windows.Visibility.Visible;        }           }}
```

\

\

Now execute [your application](https://answers.mindstick.com/qa/95487/how-do-you-troubleshoot-when-your-application-link-is-not-responding); following output will be appearing.

\

![WebBrowser Control in Windows 7 Phone Development](https://www.mindstick.com/mindstickarticle/e5957dee-a494-47da-9cd5-61fb870c02e2/images/6cc229dd-3b24-4723-9ef8-3fd12815390f.png)

Now click on button **‘Ok’**.

![WebBrowser Control in Windows 7 Phone Development](https://www.mindstick.com/mindstickarticle/e5957dee-a494-47da-9cd5-61fb870c02e2/images/87207024-bced-4a4f-a871-2b55aab1052b.png)

This is the complete description of WebBrowser control in windows phone development. I hope you will enjoy it. Thanks for reading this article.

\

---

Original Source: https://www.mindstick.com/articles/922/webbrowser-control-in-windows-7-phone-development

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
