[英]Windows Store App frame.navigate() not working
So, basically I have 2 pages: "MainPage.xaml" and "Workpage.xaml" . 所以,基本上我有2个页面:“MainPage.xaml”和“Workpage.xaml”。 I Created a button for navigation from MainPage to WorkPage and it doesn't work... Why would that be?
我创建了一个从MainPage导航到WorkPage的按钮,它不起作用......为什么会这样? It works normally in my Windows Phone App...
它在我的Windows Phone应用程序中正常工作......
<Page
x:Class="WindowsApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WindowsApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Button x:Name="btnWorkPage" Content="Button" HorizontalAlignment="Left" Margin="580,304,0,0" VerticalAlignment="Top" Height="74" Width="208" Click="btnWorkPage_Click"/>
</Grid>
Mainpage.xaml.cs: MainPage.xaml.cs中:
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void btnWorkPage_Click(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof(WorkPage));
}
}
a short DEMO: http://screencast.com/t/imblOyj5CH ... 一个简短的演讲: http : //screencast.com/t/imblOyj5CH ......
Well Seems there is some strange logic where you have to delete the MainPage and add a new one, here is some guide from MS 好吧,似乎有一些奇怪的逻辑,你必须删除MainPage并添加一个新的,这里是MS的一些指南
https://msdn.microsoft.com/en-us/library/windows/apps/hh986965.aspx https://msdn.microsoft.com/en-us/library/windows/apps/hh986965.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.