• Windows 8 应用栏


    Windows 8中右键鼠标或者操作触摸屏,屏幕底层会弹出一个菜单,这个就是应用栏。

    应用栏类似于Windows Phone中的菜单栏:

     1 <Page.BottomAppBar>
     2     <AppBar x:Name="BottomAppBar">
     3         <Grid>
     4             <Grid.ColumnDefinitions>
     5                 <ColumnDefinition Width="50*"/>
     6                 <ColumnDefinition Width="50*"/>
     7             </Grid.ColumnDefinitions>
     8             <StackPanel x:Name="LeftPanel" Orientation="Horizontal" Grid.Column="0" HorizontalAlignment="Left">
     9                 <Button x:Name="Edit" Style="{StaticResource EditAppBarButtonStyle}" Click="Edit_Button_Click"/>
    10                 <Button x:Name="Save" Style="{StaticResource SaveAppBarButtonStyle}"/>
    11                 <Button x:Name="Delete" Style="{StaticResource DeleteAppBarButtonStyle}"/>
    12             </StackPanel>
    13             <StackPanel x:Name="RightPanel" Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right">
    14                 <Button x:Name="Refresh" Style="{StaticResource RefreshAppBarButtonStyle}"/>
    15             </StackPanel>
    16         </Grid>
    17     </AppBar>
    18 </Page.BottomAppBar>

    AppBar标签中就是一个控件区域,可以设置任意的布局,上例设置的是我们在Win8应用中常见的布局,左侧几个按钮,右侧几个按钮

    按钮直接用Button控件表示,事件或Name自己添加,样式一般是用系统自带的样式,样式文件都在工程文件的路径Common/StandardStyles.xaml中

    默认这些样式的配置都是被注释的,如果需要哪些按钮样式,需要手动取消注释,如下

    <Style x:Key="RefreshAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
            <Setter Property="AutomationProperties.AutomationId" Value="RefreshAppBarButton"/>
            <Setter Property="AutomationProperties.Name" Value="Refresh"/>
            <Setter Property="Content" Value="&#xE117;"/>
        </Style>

    这样就可以通过设置Button属性 Style="{StaticResource RefreshAppBarButtonStyle}" 来更改Button样式

  • 相关阅读:
    AspNet WebApi 中应用fo-dicom抛出异常:No codec registered for tranfer syntax:
    Codeforces Round #261 (Div. 2)459A. Pashmak and Garden(数学题)
    Android开发之使用Web Service进行网络编程
    线段树 + 扫描线加深具体解释
    对Shell几个冷知识的总结(IFS,数组,替换,分割,查找)
    lscript.ld 链接器脚本
    iOS 系统地图实现及定位
    Perl怎样过滤html标签
    hdu1213 How Many Tables(并查集)
    数据结构——链表
  • 原文地址:https://www.cnblogs.com/fengbeihong/p/3023537.html
Copyright © 2020-2023  润新知