我想改變圖像源或圖像背景在c#中,當一個按鈕點擊xaml設計用戶界面。如何添加網格背景圖片在c#
<Grid x:Name="gridimage">
<Image x:Name="Image" stretch="Fill"/>
</Grid>
private void Button1_click(object sender, RoutedEventArgs e)
{
// NOT WORKING FOR ME
gridimage.Source = new BitmapImage (new Uri("location"));
gridimage.Background = ?
}
你能後的完整的XAML和代碼隱藏? –