前台
<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();
}
}
}