Windows Phone 7 Beta tools

Posted on

In my experimentation with the Windows Phone 7 developer tools, certain things have been a little hard to find information on. Here’s some of the best resources I have found, along with little nuggets of good information I have discovered and want to document.


Also keep in mind that the Windows Phone 7 SDK is based mainly on Silverlight, so many resources that apply to Silverlight can be readily applied to WP7.

Checking internet connectivity

It’s suggested in several places that Windows Phone 7 developers should test for internet connectivity in their internet-connected applications, as it is not a guaranteed resource (and of course, respond accordingly if no connection is available). However, there are few places that document how to actually do this. In the Beta version of the tools, the correct way is by testing the result of the following function:

// Available in the System.Net.NetworkInformation namespace
bool connected = NetworkInterface.GetIsNetworkAvailable();

Note that this has changed from the CTP version of the tools.

Creating a scrollable region

Another seemingly under-documented feature is how to create a region that scrolls using the typical finger scrolling action. Fortunately, this is as simple as wrapping your controls in a ScrollViewer element:

    <!-- Insert controls here -->

This gives you scrolling momentum for free, along with a little position scrollbar that appears as you scroll. Very easy!