c# - Unable to navigate to another page on button click in windows phone 8.1 -
i have button & upon clicking it, need go xaml page.
this button resides in page1.xaml
<button content="button name" horizontalalignment="center" verticalalignment="center" click="button_click" foreground="#ff119ff0"/> private void button_click(object sender, routedeventargs e) { framebody.navigate(typeof(homepage)); }
but not able navigate homepage.xaml.
what can reason??
these libraries included:
using system; using system.collections.generic; using system.io; using system.linq; using system.runtime.interopservices.windowsruntime; using windows.foundation; using windows.foundation.collections; using windows.ui.xaml; using windows.ui.xaml.controls; using windows.ui.xaml.controls.primitives; using windows.ui.xaml.data; using windows.ui.xaml.input; using windows.ui.xaml.media; using windows.ui.xaml.navigation;
the function button_click() defined in page1.xaml.cs.
this code use in project:
private void itemview_itemclick(object sender, itemclickeventargs e) { var albumid = ((album)e.clickeditem).id; if (!frame.navigate(typeof(albumpage), albumid)) { var resourceloader = resourceloader.getforcurrentview("resources"); throw new exception(resourceloader.getstring("navigationfailedexceptionmessage")); } }
the part focus on frame.navigate(typeof(albumpage))
.
i want pass information page, that's why pass albumid
.
if want retrieve passed argument in other page, might want use code:
private void navigationhelper_loadstate(object sender, loadstateeventargs e) { var albumid = (int)e.navigationparameter; }
Comments
Post a Comment