DeviceNetworkInformation.IsCellularDataRoamingEnabled 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 allows data roaming.

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

Syntax

Public Shared ReadOnly Property IsCellularDataRoamingEnabled As Boolean
public static bool IsCellularDataRoamingEnabled { get; }

Property Value

Type: System..::.Boolean
true if the network allows data roaming; otherwise, false.

Examples

The following example demonstrates getting the value of the IsCellularDataRoamingEnabled 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 IsCellularDataRoamingEnabled 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;
Imports 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.AppendLine(DeviceNetworkInformation.IsNetworkAvailable.ToString());

    sb.Append("Cellular enabled:  ");
    sb.AppendLine(DeviceNetworkInformation.IsCellularDataEnabled.ToString());

    sb.Append("Roaming enabled:  ");
    sb.AppendLine(DeviceNetworkInformation.IsCellularDataRoamingEnabled.ToString());

    sb.Append("Wi-Fi enabled:  ");
    sb.AppendLine(DeviceNetworkInformation.IsWiFiEnabled.ToString());

    MessageBox.Show(sb.ToString());
}
Private Sub Button1_Click(sender As System.Object , e As System.Windows.RoutedEventArgs) Handles Button1.Click

    Dim sb As new System.Text.StringBuilder()

    sb.Append("Network available:  ")
    sb.AppendLine(DeviceNetworkInformation.IsNetworkAvailable.ToString())

    sb.Append("Cellular enabled:  ")
    sb.AppendLine(DeviceNetworkInformation.IsCellularDataEnabled.ToString())

    sb.Append("Roaming enabled:  ")
    sb.AppendLine(DeviceNetworkInformation.IsCellularDataRoamingEnabled.ToString())

    sb.Append("Wi-Fi enabled:  ")
    sb.AppendLine(DeviceNetworkInformation.IsWiFiEnabled.ToString())

    MessageBox.Show(sb.ToString())
End Sub

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Platforms

Windows Phone

See Also

Reference

DeviceNetworkInformation Class

Microsoft.Phone.Net.NetworkInformation Namespace