【发布时间】:2014-05-12 07:55:25
【问题描述】:
我想在网格中显示图像
Only the image shows 当我使用这个 XAML 时:
<Image Source="/Assets/O.png"
Grid.Column="6"
Grid.Row="5"/>
在 C# 中,它显示带有边框的图片:
Image img = new Image();
BitmapImage bi = new BitmapImage();
bi.UriSource = new Uri("/Assets/O.png", UriKind.Relative);
img.Stretch = Stretch.Fill;
img.Source = bi;
Grid.SetColumn(img, 6);
Grid.SetRow(img, 7);
gridGameBoard.Children.Add(img);
Image img1 = new Image();
img1.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("/Assets/X.png", UriKind.Relative));
Grid.SetColumn(img1, 4);
Grid.SetRow(img1, 4);
gridGameBoard.Children.Add(img1);
我尝试在谷歌上搜索 BitmapImage 和其他图像类型之间的差异,但没有成功。
【问题讨论】:
标签: c# image xaml windows-phone-8