0
如何更改應用程序包外部的ImageSource?我使用的是:將ImageSource設置爲應用程序包外部的路徑
FileOpenPicker picker = new FileOpenPicker();
picker.FileTypeFilter.Add(".jpg");
StorageFile file = await picker.PickSingleFileAsync();
if (file != null)
{
grid.Background = new ImageBrush
{
ImageSource = new BitmapImage(new Uri(file.Path, UriKind.Absolute))
};
}
但是,當我選擇我想要的圖像後,它只是不顯示爲網格背景。它什麼都沒顯示!這裏是XAML:
<Border BorderBrush="Black" BorderThickness="1" Margin="315,260,85,140" Width="100" Height="100">
<Grid x:Name="grid" Margin="0" Visibility="Visible">
</Grid>
</Border>
謝謝!
感謝您的幫助! –