【发布时间】:2015-02-14 23:39:07
【问题描述】:
所以我有这段代码,它为数组中的每个字符串添加文件路径并将其用作图像框的文件路径,这是代码:
private async void Button7_Click(object sender, RoutedEventArgs e)
{
string[] images = new string[] { "Star_00001.png", "Star_00002.png", "Star_00003.png", "Star_00004.png", "Star_00005.png", "Star_00006.png", "Star_00007.png", "Star_00008.png"};
string path = "Assets/Star/";
foreach(string file in images)
{
string thepath = Path.Combine(path,file);
await Task.Delay(46);
BitmapImage Image = new BitmapImage();
Image.UriSource = new Uri(this.BaseUri, thepath);
StarImage.Source = Image;
}
}
现在每次将新图像加载到 StarImage 时,它都会闪烁,据我所知,他们无法阻止这种情况,因为这是在图像框中加载新图像的效果,但是有人知道吗停止这种情况并产生动画效果的替代方法?
【问题讨论】:
-
这真的是关于 WPF,还是您正在构建一个商店应用程序?
-
我已经编辑了问题标签。 Windows 应用商店应用不使用 WPF。
标签: c# image xaml windows-runtime windows-store-apps