【发布时间】:2016-09-07 13:07:46
【问题描述】:
我有问题。为什么它没有导航到其他 xaml?哪里错了? 所以,我试图让它可以在一个框架中的两个或多个 xaml 之间导航。
这里是链接:https://github.com/Englbach/MutiViewInRootPage
<SplitView.Content>
<!-- OnNavigatingToPage we synchronize the selected item in the nav menu with the current page.
OnNavigatedToPage we move keyboard focus to the first item on the page after it's loaded. -->
<Frame x:Name="AppShellFrame">
<Frame.ContentTransitions>
<TransitionCollection>
<NavigationThemeTransition>
<NavigationThemeTransition.DefaultNavigationTransitionInfo>
<EntranceNavigationTransitionInfo />
</NavigationThemeTransition.DefaultNavigationTransitionInfo>
</NavigationThemeTransition>
</TransitionCollection>
</Frame.ContentTransitions>
</Frame>
</SplitView.Content>
public static AppShell Current = null;
public List<NavMenuItem> NavList { get; } = new List<NavMenuItem>(new[]
{
new NavMenuItem()
{
Symbol = Symbol.Add,
Label = "Add feed",
DestPage = typeof(RootPages),
Arguments = typeof(AddFeedView)
},
new NavMenuItem()
{
Symbol = Symbol.Edit,
Label = "Edit feeds",
DestPage = typeof(RootPages),
Arguments = typeof(EditFeedView)
}
});
public AppShell()
{
this.InitializeComponent();
Current = this;
}
private void NavMenuList_ItemInvoked(object sender, ListViewItem e)
{
NavMenuList.SelectedIndex = -1;
var item = (NavMenuItem)((NavMenuListView)sender).ItemFromContainer(e);
if(item!=null)
{
AppFrame.Navigate(typeof(RootPages), item.Arguments);
}
}
【问题讨论】:
-
你的调试器告诉你什么?即您是否正在点击事件处理程序?是否正确检索项目?
-
没有错误。当我单击 navmenuitem 上的每个项目但没有任何内容时。
-
我想单击 navmenuitem 上必须导航到该框架中的其他 xaml 的每个项目
-
例如:Frame 中的默认 RootPages。我单击添加提要,然后导航到 AddFeedView 被 RootPages 替换。
-
它是否命中了您方法中设置的断点?
标签: c# xaml win-universal-app