是否可以仅显示一个 Pivot 项目的应用程序栏? [英] Is it possible to show Application bar for one Pivot item only?

查看:9
本文介绍了是否可以仅显示一个 Pivot 项目的应用程序栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows Phone 7 应用程序中,我使用 Pivot for UI.作为 Pivot 的一项,XAML 页面被插入,如:

In a Windows Phone 7 application I use a Pivot for UI. As one of the items of the Pivot a XAML page is inserted, as:

<Pivot_Item>
<myviews:a_page.xaml/>
</Pivot_Item>

应用程序栏 - 标准模板 - 仅在该页面中使用,因为整个 Pivot 不需要它.但这不起作用.目前我只能激活每个 Pivot 项目的栏,或者将其用于单独的非 Pivot 页面.

An application bar - a standard template - is used within that page only, as the whole Pivot doesn't need it. But this doesn't work. For now I was only able either to activate the bar for the every Pivot item or to use it for a separate non-pivot page.

推荐答案

最简单的方法就是处理 Pivot 的 LoadingPivotItem 事件.

The easiest way to do this is simply to handle the Pivot's LoadingPivotItem event.

为 PivotItem 指定一个名称:

Assign that PivotItem a name:

<Pivot_Item Name="myPivotItem">
<myviews:a_page.xaml/>
</Pivot_Item>

在代码中:

private void pivotMain_LoadingPivotItem(object sender, PivotItemEventArgs e)
{
     if (e.Item == myPivotItem) 
        ApplicationBar.IsVisible = true;
     else
        ApplicationBar.IsVisible = false;  
}

这篇关于是否可以仅显示一个 Pivot 项目的应用程序栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆