Search

Tuesday, November 12, 2013
0 comments

Windows Store:How to Add item in GridView

1:22 AMTuesday, November 12, 2013
  1. Add a GridView control to a parent container using XAML code editor with name attribute.
<GridView x:Name="GridView1" >           

</GridView>

To assign a name to the grid view, set the x:Name attribute to a string value. To refer to a control in code, it must have a name. Otherwise, a name is not required.

2. Add items to the grid view by populating the Items collection or by binding the ItemsSource property to a data source.
 
<GridView x:Name="GridView1" > 
<x:String> name </x:String>
<x:String> City </x:String>          

</GridView>

Start Screen

Windows Store:How to Add item in GridView
 
Windows Store:How to Add item in GridView
 

Apply II method in code file

1. Create a List of String Items and bind with GridView control in main file constructor.
 

public MainPage()

{

 

this.InitializeComponent();

List<String> itemcoll = new List<String>();

itemcoll.Add("Apple");

itemcoll.Add("Mango");
itemcoll.Add("Orange");

GridView1.ItemsSource = itemcoll;

}

 
Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top