win8 AppBar

本文探讨了应用栏交互的实现方式,并展示了后端如何响应这些操作,包括顶部和底部栏的开合状态变化及按钮点击事件处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前台

<Page
    x:Class="动画2.AppBar"
    xmlns="
http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="
http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:动画2"
    xmlns:d="
http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="
http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.TopAppBar>
        <AppBar IsOpen="True" Opened="AppBar_Opened_1" Closed="AppBar_Closed_1" >
            <StackPanel Orientation="Horizontal">
                <Button  Style="{StaticResource PlayAppBarButtonStyle}" AutomationProperties.Name="播放" Click="Button_Click_1"/>
                <Button  Style="{StaticResource PauseAppBarButtonStyle}" AutomationProperties.Name="暂停"/>
                <Button Style="{StaticResource YesAppBarButtonStyle}"/>
            </StackPanel>
        </AppBar>
    </Page.TopAppBar>
    <Page.BottomAppBar>
        <AppBar IsSticky="True">
            <Button Content="同步"/>
        </AppBar>
    </Page.BottomAppBar>
    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Button Content="点我" FontSize="30"/>
    </Grid>
</Page>

 

 

 

后台

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// “空白页”项模板在 http://go.microsoft.com/fwlink/?LinkId=234238 上有介绍

namespace 动画2
{
    /// <summary>
    /// 可用于自身或导航至 Frame 内部的空白页。
    /// </summary>
    public sealed partial class MyAppBar : Page
    {
        public MyAppBar()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// 在此页将要在 Frame 中显示时进行调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。Parameter
        /// 属性通常用于配置页。</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {

        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            MessageDialog mes = new MessageDialog("OK");
            mes.ShowAsync();
        }

        private void AppBar_Opened_1(object sender, object e)
        {
            //MessageDialog mes = new MessageDialog("TopAppBar显示");
            //mes.ShowAsync();
        }

        private void AppBar_Closed_1(object sender, object e)
        {
            //MessageDialog mes = new MessageDialog("TopAppBar隐藏");
            //mes.ShowAsync();
        }
    }
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值