The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DeviceNetworkInformation.IsNetworkAvailable Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets a value that indicates whether the network is available.

Namespace:  Microsoft.Phone.Net.NetworkInformation
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)

public static bool IsNetworkAvailable { get; }

Property Value

Type: System.Boolean
true if there is at least one network interface available; otherwise, false.

The network interface must be available and connected.

The following example demonstrates getting the value of the IsNetworkAvailable property and displaying it in a message box. In this example, you put the code in a button click event for testing purposes only. In your own applications, you can access the IsNetworkAvailable property wherever you need it.

This example assumes that you have a Windows Phone application with a button named button1. This example also assumes that you have added the following statement to your code window.

using Microsoft.Phone.Net.NetworkInformation;
private void button1_Click(object sender, RoutedEventArgs e)
    System.Text.StringBuilder sb = new System.Text.StringBuilder();

    sb.Append("Network available:  ");

    sb.Append("Cellular enabled:  ");

    sb.Append("Roaming enabled:  ");

    sb.Append("Wi-Fi enabled:  ");


Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone