In this article we will describe the preliminary use of the GridView to present various information.
First we look at the important attributes of the GridView:
SelectionMode: Setting selection mode (none,single,multiple)
Isitemclickenabled: Allow selective click events
ItemsSource: Data source for data items
ItemTemplate: Presentation template for data items
SelectedItem: Selecting the contents of an item
Then we'll see how to use the GridView.
1. First set up the data source entity class and the data source provider source.
public class Datamodel {public string Txttitle {get; set;}
public string Txtcontent {get; set;}
public string ImageUrl {get; set;}
public class Datagroupmodel {public string GroupTitle {get; set;}
Public observablecollection<datamodel> itemcontent {get; set;}
public class Viewmodeldata {public Viewmodeldata () {sourcedata = Getdatagroup ();
Private observablecollection<datagroupmodel> _sourcedata;
Public observablecollection<datagroupmodel> SourceData {get {return _sourcedata;}
set {_sourcedata = value;} Public observablecollection<datagroupmodel> Getdatagroup () {return new Observablecoll Ection<datagroupmodel> () {new Datagroupmodel () {grouptitle= "fantasy novel", itemcontent= New ObservableCollection<DataModel> () {new Datamodel () {txttitle= "Panlong", txtcontent= "the size of the blood-eye mane Lions, the mighty infinite purple-eye golden Hairy ape, destroyed the days of the nine-head snake, carrying The horror of the destruction of the Thunder Dragon ... This is a vast and magical world. ", Imageurl=" Jpg/1017141.jpg "}, new Datamodel () {txttitle=" Samsara ", txtcontent=" Li Jinghan ", this is the great avatar with hundreds director , in charge of the world's last God Reizhu and Shenrei a rebirth of the world. Shenrei force, penalty the world ", Imageurl=" Jpg/1.jpg "}, new Datamodel () {txttitle=" Wizarding World ", txtcontent=" cross into the world to become ordinary home Family of children, with the ability to analyze the biological chip to start a powerful journey ... ", Imageurl=" Jpg/2443169.jpg "}, new Datamodel () {txttitle=" Kill God ", txtcontent=" in the mad world of this man's eating man, God is powerless. , let me tread on the countless bones of the gods all over this mortal being ... ", imageurl=" Jpg/1911245.jpg "}}, New Da
Tagroupmodel () {grouptitle= "online novel", Itemcontent=new observablecollection<datamodel> () {
New Datamodel () {txttitle= "Full time Master", txtcontent= "the glory of online games is known as the top of the textbook level, because of various reasons by the club's expulsion, leaving the professional circle of his salvation means in an internet café became a small network management,
", Imageurl=" Jpg/1887208.jpg "}, New Datamodel () {txttitle= "The Thief of Rebirth", txtcontent= "The Lonely traveler, chasing the footsteps of the shadow, this is the anthem of the thieves." With a 180-class memory of the big thieves, back to ten years ago, the fate of Nie Yan opened a joke ", Imageurl=" Jpg/1693876.jpg "}, new Datamodel () {txttitle=" Hu
Pearl's Sword ", txtcontent=" fate in front of my eyes separate into two unrelated straight lines, a blazing fire in the palace and the city, the kingdom capsized, the earth carrying suffering, the living in this fire endure suffering ", imageurl=" Jpg/1784765.jpg "}, The new Datamodel () {txttitle= "The Sword of Dictatorship", txtcontent= "the Light of Wisdom from silver Yiu Heaven, The guardian of the forces of nature, the king of the Druids of the though Godhead of Artemis."
", Imageurl=" Jpg/2172318.jpg "}}}; }
}