Grid is the only panel class that can customize cells internally. We can customize cells in the grid and then use grid. row and grid. column is used to locate the position where the grid contains elements. It has powerful functions and is used in many cases. view its attributes: [Author: shenzhenlong]
Background
Obtain or set a brush used to fill the panel, so we can plot the background, for example, in the following case:
<!-ContentPanel-place additional content here->
<Grid x: Name = "ContentPanel" Grid.Row = "1" Margin = "12,0,12,0"
>
<Grid.Background>
<RadialGradientBrush>
<GradientStop Offset = "0.9" Color = "DarkBlue"> </ GradientStop>
<GradientStop Offset = "0.8" Color = "Firebrick"> </ GradientStop>
</ RadialGradientBrush>
</Grid.Background>
</ Grid>
Its display effect:
Clip
Get or set the content border used to define the grid
Geometry, the following effect is similar to the effect of the last day of the day when the dog eats the month
XAML code:
<!-ContentPanel-place additional content here->
<Grid x: Name = "ContentPanel" Grid.Row = "1" Margin = "12,0,12,0"
>
<Grid.Background>
<RadialGradientBrush>
<GradientStop Offset = "0.9" Color = "White"> </ GradientStop>
<GradientStop Offset = "0.8" Color = "Black"> </ GradientStop>
</ RadialGradientBrush>
</Grid.Background>
<Grid.Clip>
<EllipseGeometry Center = "240 250" RadiusX = "180" RadiusY = "190"> </ EllipseGeometry>
</Grid.Clip>
</ Grid>
Effect:
In other words, the effect was good, but he could not modify the parameters to achieve the whole process of the dog's monthly subscription. The above effect was accidentally made;
Geometry class
The base class is provided for objects used to define geometric shapes. Therefore, ellipsegeometry and geometrygroup can inherit all of their classes. For example, we can use rectangelgeometry to obtain the rectangular editing area.
XAML code:
<!-ContentPanel-place additional content here->
<Grid x: Name = "ContentPanel" Grid.Row = "1" Margin = "12,0,12,0"
>
<Grid.Background>
<RadialGradientBrush>
<GradientStop Offset = "0.1" Color = "Purple"> </ GradientStop>
<GradientStop Offset = "0.2" Color = "Blue"> </ GradientStop>
</ RadialGradientBrush>
</Grid.Background>
<Grid.Clip>
<RectangleGeometry>
<RectangleGeometry.Rect>
<Rect X = "20" Y = "30" Width = "300" Height = "400"> </ Rect>
</RectangleGeometry.Rect>
</ RectangleGeometry>
</Grid.Clip>
</ Grid>
Effect:
We can add some other elements from the hidden file:
// Constructor
public MainPage ()
{
InitializeComponent ();
LayoutDesign ();
}
private void LayoutDesign ()
{
TextBlock DeptListHeading = new TextBlock ();
DeptListHeading.Text = "Department";
ListBox DeptList = new ListBox ();
DeptList.Items.Add ("Finance");
DeptList.Items.Add ("Marketing");
DeptList.Items.Add ("Human Resources");
DeptList.Items.Add ("Payroll");
DeptList.Items.Add (DeptListHeading);
this.ContentPanel.Children.Add (DeptList);
}
Effect:
This comparison Basics