Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Twitter: Posting Tweets using WebBrowser

From Wiki
Jump to: navigation, search

This article explains how to post a tweet using the Web Browser control

WP Metro Icon Web.png
SignpostIcon XAML 40.png
WP Metro Icon WP8.png
Article Metadata
Tested with
SDK: Windows Phone 8.0 SDK
Devices(s): Nokia Lumia 820
Windows Phone 8
Created: mfabiop (07 Jul 2013)
Last edited: hamishwillee (26 Jul 2013)



There are many ways of advertising an application, one of the best is to share the application between the user's friends. Posting on Twitter is a very easy and fast way of doing that, as you'll see in this article. As this article is really simple, the next section will describe all the needed steps to share an application using the Twitter.

Web Browser control is not the focus of this article, to see more details about it take a look at this article WebBrowser Control Techniques in Windows Phone.


  1. Put the WebBrowser control in your XAML page.
    <phone:WebBrowser x:Name="webBrowser"  Visibility="Collapsed"/>
  2. Call the following code in any button of your code behind page
    webBrowser.Visibility = Visibility.Visible;
    string text = "I'm using the Hello World application! Use you too! http://link-to-app-on-store";
    webBrowser.Navigate(new Uri("" + text));

Note.pngNote: Notice that the Visibility property is set to Collapsed by default and it is changed to Visible when the user click the button. It's a needed step to not show a blank page before the user chose to share the application.

User instructions

The user will have to login on Twitter once before share your application. Let he know that your application will not keep his password saved, despite the fact he is going to do this only one time.

A different approach

Vaishali Rawat shown a very good approach in this article (Twitter: Posting Tweets using Hammock) to do the same, using the Hammock library. If the Twitter interface is not an option or you need to keep logged on Twitter between the application pages, the Hammock library is a better option.

This page was last modified on 26 July 2013, at 00:09.
53 page views in the last 30 days.