The GridView control

The GridView control represents a set of scrollable items in rows and columns, stacked in a horizontal manner until they need to wrap to the next line. It is often used to display a photo/media gallery or a home page/dashboard of navigational linked items in a large display:

The elements can be dynamically added to its Items property from code behind class. You can also do a data binding of a collection of items to its ItemsSource property. In case you have some static data that won't change, you can directly place it in XAML inside the GridView tag as written in the following code to demonstrate the preceding example:

  <GridView> 
      <Rectangle Fill="Orange"  
                 Width="250" Height="150" Margin="4"/> 
      <Rectangle Fill="Orange"  
                 Width="250" Height="150" Margin="4"/> 
      <Rectangle Fill="Orange"  
                 Width="250" Height="150" Margin="4"/> 
      <Rectangle Fill="Orange"  
                 Width="250" Height="150" Margin="4"/> 
      <Rectangle Fill="Orange"  
                 Width="250" Height="150" Margin="4"/> 
      <Rectangle Fill="Orange"  
                 Width="250" Height="150" Margin="4"/> 
      <Rectangle Fill="Orange"  
                 Width="250" Height="150" Margin="4"/> 
     <Rectangle Fill="Orange"  
                 Width="250" Height="150" Margin="4"/> 
  </GridView> 

Here, we have added eight Rectangle controls which stack horizontally first and then move to the next row when it is unable to accommodate the next item within the same line. If you resize the window, based on the available space, the items will automatically reposition themselves in rows. When there are more items than the available space, it will add a scrollbar for a scrolling experience.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.172.115