Windows phone 7 如何创建网格边界?
这就是我想要创造的。白色区域是Windows phone 7 如何创建网格边界?,windows-phone-7,Windows Phone 7,这就是我想要创造的。白色区域是网格中的系统.窗口.形状.矩形。这是我创建网格、列、行和矩形的代码 Grid newGrid = new Grid(); for(int r=0; r<10; r++ ) { newGrid.RowDefinitions.Add( new RowDefinition { Height = new GridLength(30) }); for( int c=0; c<10; c++ ) { newGrid.
网格中的系统.窗口.形状.矩形
。这是我创建网格、列、行和矩形的代码
Grid newGrid = new Grid();
for(int r=0; r<10; r++ ) {
newGrid.RowDefinitions.Add(
new RowDefinition { Height = new GridLength(30) });
for( int c=0; c<10; c++ ) {
newGrid.ColumnDefinitions.Add(
new ColumnDefinition { Width = new GridLength(30) });
Rectangle rec = new Rectangle{
Fill = new SolidColorBrush(Colors.White)
};
Grid.SetColumn(rec, c);
Grid.SetRow(rec, r);
newGrid.Children.Add(rec);
}
}
LayoutRoot.Children.Add(newGrid);
Grid newGrid=newGrid();
对于(int r=0;rTry
您可能会考虑使用TileBrush()@ MiqBAL您的代码发生了什么?它不起作用吗?但是,在这种情况下,好像网格边界比单元格边框的厚度要小。
SolidColorBrush blackBrush = new SolidColorBrush();
blackBrush.Color = Colors.Black;
rec.Stroke = blackBrush;