As the subject says I want to insert an image into the 2nd column of grid defined with 2 columndefintions.
就像题目说的,我想把一个图像插入到用2列定义的网格的第二列中。
Programmatically that is???
以编程方式是? ? ?
I cannot see how to select the column using grid.Children.insert(1, img) does not work.
我无法看到如何使用grid.Children选择列。插入(1,img)不起作用。
Malcolm
马尔科姆
2 个解决方案
#1
7
Image imgControl = new Image();
Grid.SetColumn(imgControl, 1);
gridContainer.Children.Add(imgControl);
Objects contained in a grid are positioned based on the attached dependency properties Column Row ColumnSpan and RowSpan which are set as shown above.
包含在网格中的对象是基于附加的依赖属性列列列列列列列列列span和行span进行定位的,如上面所示。
#2
#1
7
Image imgControl = new Image();
Grid.SetColumn(imgControl, 1);
gridContainer.Children.Add(imgControl);
Objects contained in a grid are positioned based on the attached dependency properties Column Row ColumnSpan and RowSpan which are set as shown above.
包含在网格中的对象是基于附加的依赖属性列列列列列列列列列span和行span进行定位的,如上面所示。