【发布时间】:2012-09-05 02:15:38
【问题描述】:
我正在使用 FlipView 控件来翻阅各种页面,即 *.XAML 页面。我正在使用Page 类的ObservableCollection。现在这些页面中的一个页面包含 AppBar,但 AppBar 也可以在集合中的任何其他 XAML 页面中打开。如何防止在所有页面中打开 AppBar?
简单说明:- 我有四个 XAML 页面。
(1) MainPage.xaml(仅包含Page类的FlipView和ObservableCollection)
(2) PageWithAppBar.xaml(AppBar在本页)
(3) PageWithoutAppBar.xaml
(4) PageWithoutAppBar2.xaml
现在通过翻转视图,当我打开 PageWithoutAppBar.xaml 或 PageWithoutAppBar2.xaml 并按右键然后按 PageWithAppBar 的 AppBar .xaml 变得可见,所以我不想要那个东西,我该如何防止呢?
到目前为止我尝试了什么?
我创建了一个函数来检查 AppBar 应该在哪个页面中可见。 我试图设置
Visibility = Collapsed,
IsOpen = false,
this.BottomAppBar = null,
IsEnable = false
然后它也出现了
【问题讨论】:
-
实际的 AppBar 是在哪里定义的?在 MainPage.xaml 中?
-
底部 AppBar 在 PageWithAppBar.xaml 中定义
-
你在定义它的 AppBar 上试过 IsSticky = false 吗?
-
好的,发布一些 XAML 和代码隐藏可能会有所帮助。从 MainPage.xaml、PageWithAppBar.xaml 和 PageWithoutAppBar.xaml 开始 :)
-
如果没有任何效果,您可以在离开之前在 PageWithAppBar.xaml 上使用 IsOpen = false 隐藏 AppBar。
标签: c# xaml microsoft-metro windows-runtime appbar