我的項目中有一個頁面,當用戶在屏幕中觸摸時,此頁面會將我的資源中的背景屬性更改爲隨機圖片,但當更改時,頁面背景會在0.05秒前變爲黑色或白色改變我的形象。這很醜陋。當更改頁面背景時圖片更改可怕
這裏是我在CS代碼文件
private void LayoutRoot_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
{
Random ran = new Random();
randomPage.Background = new ImageBrush
{
ImageSource =
new BitmapImage { UriSource = new Uri("ms-appx:///Assets/Backgrounds/" + ran.Next(22) + ".jpg") }
};
e.Handled = true;
}
我能做些什麼來改變圖像頁面背景流暢?
你可以創建一個簡短的動畫來將圖像淡化爲0%不透明度,切換圖像,然後回到100%? –