public class TileItem
{
public string ImageUri
{
get;
set;
}
public string Title
{
get;
set;
}
public string Notification
{
get;
set;
}
public bool DisplayNotification
{
get
{
return !string.IsNullOrEmpty(this.Notification);
}
}
public string Message
{
get;
set;
}
}
Step 6: Add below code in the constructor of the MainPage.xaml. The list will contain object of TileItem class created above and finally the list will be binded to listbox placed in MainPage.xaml.
List<TileItem> tileLists = new List<TileItem>()
{
new TileItem() {
ImageUri ="/Images/Desert1.png",
Title = "Desert1",
Message = "It's real yummy. Try it!!"
},
new TileItem() {
ImageUri ="/Images/Desert2.png",
Title = "Desert2", Notification = "Avail Disc"
},
new TileItem() {
ImageUri ="/Images/Desert3.png",
Title = "Desert3", Notification = "No Disc",
Message = "It's real yummy. Try it!!"
},
new TileItem() {
ImageUri ="/Images/Desert4.png",
Title = "Desert4", Notification = "No Disc"
}
};
this.tileList.ItemsSource = tileLists;
Note: I ran the application on emulator and waited for 5 minutes message to appear in therd tile but it never appeared. Message appeared only for first tile. It made me feel that if notification and message both are there only Notification will be displayed. This is not documented anywhere but it made me believe so
Step 6: Add tap_HubTile method in MainPage.xaml.cs which will be triggered on tap of hubtile.
void tap_HubTile(object sender, System.Windows.Input.GestureEventArgs e)
{
HubTile hb = sender as HubTile;
MessageBox.Show(hb.Title + " " + "tapped");
}
Step 7: Now run the application, four hubtiles will be displayed and on click of any of it you will get messagebox like shown below.