我试图将一个对齐Image
到单元格的中心Grid
。是Image
在一个Canvas
. 我该怎么做呢?
private void image()
{
Image myBarCode = new Image();
myBarCode.Width = 400;
myBarCode.Height = 300;
myBarCode.HorizontalAlignment = Left;
myBarCode.Source = new BitmapImage(new Uri("C:/Users/mark/Desktop/resident images/Doris.jpg", UriKind.RelativeOrAbsolute));
mainCanvas1.Children.Add(myBarCode);
}