【问题标题】:Windows Store App frame.navigate() not workingWindows 应用商店应用 frame.navigate() 不工作
【发布时间】:2015-02-07 21:22:14
【问题描述】:

所以,基本上我有 2 页: "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 的静态资源(如样式)
  • 我已经添加了解决方案,该死的,这花了我太多时间了 :D

标签: c# xaml windows-store-apps


【解决方案1】:

看来有一些奇怪的逻辑,你必须删除 MainPage 并添加一个新的,这是 MS 的一些指南

https://msdn.microsoft.com/en-us/library/windows/apps/hh986965.aspx

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多