zoukankan      html  css  js  c++  java
  • WP开发笔记——不同Item显示不同ApplicationBar:适用于Pivot与Panorama

    一、在xaml页面定义两个ApplicationBar:

    <phone:PhoneApplicationPage.Resources>
    
            <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" x:Key="appBar0" Mode="Default">
                <shell:ApplicationBarIconButton Text="appBarBtn0" IconUri="appBarBtn0.png" Click="appBarBtn0_Click"/>
                <shell:ApplicationBar.MenuItems>
                    <shell:ApplicationBarMenuItem Text="appBarMenu0" Click="appBarMenu0_Click"/>
                </shell:ApplicationBar.MenuItems>
            </shell:ApplicationBar>
    
            <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" x:Key="appBar1" Mode="Default">
                <shell:ApplicationBarIconButton Text="appBarBtn1" IconUri="appBarBtn1.png" Click="appBarBtn1_Click"/>
                <shell:ApplicationBar.MenuItems>
                    <shell:ApplicationBarMenuItem Text="appBarMenu1" Click="appBarMenu1_Click"/>
                </shell:ApplicationBar.MenuItems>
            </shell:ApplicationBar>
            
        </phone:PhoneApplicationPage.Resources>

    二、在cs代码中事件函数中加入一下代码(这里以panorama为例子):

    #region panorama不同item显示不同applicationbar
    private void panoramaPage_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
      switch (((Panorama)sender).SelectedIndex)
      {
        case 0:
          ApplicationBar = (ApplicationBar)this.Resources["appBar0"];
          break;
        case 1:
          ApplicationBar = (ApplicationBar)this.Resources["appBar1"];
          break;
      }
    }
    #endregion
  • 相关阅读:
    三级菜单打怪升级,young -> plus -> pro
    Python注释是什么东东
    腾讯云中的mysql镜像数据定时同步到本机数据库
    linux重复命令的简洁化
    快速查询mysql中每个表的数据量
    MGR与MHA
    mysql基础练习
    mongo日常操作备忘
    MongoDB:删除操作
    MongoDB插入数据的3种方法
  • 原文地址:https://www.cnblogs.com/chenguangqiao/p/3705969.html
Copyright © 2011-2022 走看看