c# - how to get clicked item in my another page -
my book class
public class book{ public string title { get; set; } public string bookcover{ get; set; } } public class bookmanager { public static list<book> getbook() { var bookid= new list<book>(); bookid.add(new book{ title = "fruits", bookcover= "assets/1.jpg" }); bookid.add(new book{ title = "food", bookcover= "assets/2.jpeg" }); return bookid; } }
my mainpage xaml
<gridview itemssource="{x:bind bookid}" margin="0,0,49,121" itemclick="gridview_itemclick" isitemclickenabled="true" > <gridview.itemtemplate> <datatemplate x:datatype="local:book"> <grid height="186" width="155"> <image stretch="fill" source="{x:bind <gridview itemssource="{x:bind bookcover}" margin="0,0,49,121" itemclick="gridview_itemclick" isitemclickenabled="true" > </grid> </datatemplate> </gridview.itemtemplate> </gridview>
xaml.cs
here source code in xaml.cs have written code navigate image so code should write in itempage retrieve bookcover image. me please i'm new here!
private void gridview_itemclick(object sender, itemclickeventargs e) { var mybooks= ((book)e.clickeditem).bookcover; this.frame.navigate(typeof(itempage), mybooks); }
page class have implemented interface ipageoverrides. need override in itempage below:
protected override void onnavigatedto(navigationeventargs e) { ////this.frame.navigate(typeof(itempage), mybooks); //e.parameter mybooks. }
wiki
Comments
Post a Comment