Background and clip of the Windows Phone (21) grid Element

Source: Internet
Author: User


 

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.