Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 获取Windows phone 8.1的当前区域_C#_.net_Windows Phone 8_Windows Phone 8.1 - Fatal编程技术网

C# 获取Windows phone 8.1的当前区域

C# 获取Windows phone 8.1的当前区域,c#,.net,windows-phone-8,windows-phone-8.1,C#,.net,Windows Phone 8,Windows Phone 8.1,在获取Windows Phone 8.1(SilverLight)中的用户设置区域时,我遇到了一个问题 情况:我已将区域设置为英国,语言设置为英语(美国)(这样做是有效的) 在这种情况下,我仍然通过以下方法获取地区UnitedState(US): RegionInfo Thread.CurrentThread System.Globalization private static void GetRegion() { // all of the three returing Unite

在获取Windows Phone 8.1(SilverLight)中的用户设置区域时,我遇到了一个问题

情况:我已将区域设置为
英国
,语言设置为
英语(美国)
(这样做是有效的)

在这种情况下,我仍然通过以下方法获取地区
UnitedState(US)

  • RegionInfo
  • Thread.CurrentThread
  • System.Globalization

    private static void GetRegion()
    {
        // all of the three returing UnitedStates.
        var dfg = RegionInfo.CurrentRegion;
        var cuture = Thread.CurrentThread.CurrentCulture;
        var cul = CultureInfo.CurrentCulture;
    }
    

为什么不将英国作为一个地区返回?

基于我之前的回答:

字符串区域=
Windows.System.UserProfile.GlobalizationPreferences.HomeGeographicRegion;

您可以使用前面提到的通常用于WP8或WP8.1的
RegionInfo.CurrentRegion
属性


很抱歉,我忘了提到我正在WP8.1 silverlight上开发。@我知道了,循环似乎是8.1运行时中唯一一个修复了它的方法,请参阅:谢谢您的参考,但确实不能使用它。这不是一个好的解决方案:(你是如何设置区域的?设置正确吗?@xmashallax是的,我设置了。我去设置=>region=>selected UnitedKingdom-(没有更改语言)=>重新启动手机=>再次检查地区=>it UK。看看这个StackO问题/答案也许你可以在那里找到更多信息:没有帮助已经检查过了..我不想改变语言。这是有效的。我想改变国家,不需要改变语言。