Windows Store应用程序frame.navigate()无法工作

3

基本上,我有两个页面:“MainPage.xaml”和“Workpage.xaml”。我已经创建了一个按钮来从MainPage导航到WorkPage,但它不起作用...这是为什么呢?在我的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:

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();

    }

    private void btnWorkPage_Click(object sender, RoutedEventArgs e)
    {
        Frame.Navigate(typeof(WorkPage));
    }
}

一个简短的演示:http://screencast.com/t/imblOyj5CH ...

你能否分享一下 WorkPage.xaml 的 XAML 代码?你可能正在使用一个静态资源(比如样式),这个资源只适用于 Windows Phone。 - Ateik
我已经添加了解决方案,这真的花费了我太多的时间 :D - klanc
1个回答

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接