2
我喜歡在XAML中使用一個Image控件做簡單的動畫,並在1秒內將Image
的Source換爲其他。C#XAML Metro Image動態來源
但是,當我這樣做,圖像閃爍。我使用此代碼(在Timer
Tick
事件處理程序):
Uri uri = new Uri("ms-appx:/Sprites/Running/" + y++ + ".png",
UriKind.RelativeOrAbsolute);
BitmapImage textureBitmap = new BitmapImage(uri);
this.ImageHolder.Source = textureBitmap;
的問題在哪裏呢?我應該緩存BitmapImages?
謝謝你的幫助。
是的,但我想要不使用Storyboard。有沒有其他的方法? –
開始嘗試動畫之前預加載圖像。 –
使用帶有實例的'Dictionary'來預加載,然後通過int索引訪問它嗎? –