如何更改 Windows phone 应用程序的背景图片

How do I change the background image of a Windows phone app

我正在开发一个 WP8 应用程序,想用几张图片更改背景 image;将时间设置为变量并在 C# 中显示图像,

您可以使用 DispatcherTimer class 来根据时间更改图像。

让我向您推荐最简单的方法。将您的图像命名为数字,例如 1.jpg、2.jpg、3.jpg 等并将它们放入文件夹中。

现在您可以使用随机数 class 随机选择图像,也可以使用以下方法按顺序获取图像:

DispatcherTimer picture_timer = new DispatcherTimer();
Random rnd = new Random();

picture_timer .Interval = new TimeSpan(0, 0, 3);
                   picture_timer .Tick += timer_Tick;
                   picture_timer .Start();

 void timer_Tick(object sender, object e)
        {
int num = rnd.Next(1, 13); // creates a number between 1 and 12
string image_source = "/Assets/"+num+".jpg";

}