如何根据Windows Phone 8中的国家/地区动态更改徽标图像

时间:2014-03-12 07:06:18

标签: windows-phone-8

我的App页面中有五个国家/地区徽标图像。 现在我想根据国家/地区动态更改徽标。 我该如何更换徽标?

请帮忙

1 个答案:

答案 0 :(得分:0)

步骤1:声明一个像这样的全局变量

BitmapImage位;

第2步: 使用switch语句选择你的图像uri:

public void ChoseUri(string cuntryName)
        {
            switch (cuntryName)
            {
                case "US":
                    bit = new BitmapImage(new Uri(@"Image/Us.png", UriKind.RelativeOrAbsolute));
                    break;
                case "INDIA":                                 
                    bit = new BitmapImage(new Uri(@"Image/INDIA.png", UriKind.RelativeOrAbsolute));
                    break;
               default:
            }
        }

步骤3:动态设置图像源:

imgCountry.Source =位;