我们在操作metro 的时候,可以通过右手指从屏幕右边缘水平向左划下,然后出现 The charms bar.
在这个The charms bar 里面我们可以做很多事情,比如应用程序的设置啊、或者系统登录窗口啊。。
下面就简单介绍下: Displaying the charms bar
实现方式:
首先新建一个用户自定义控件 SimpleSetting
Code-behind:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.ApplicationSettings;
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=234236 上提供
namespace App4
{
public sealed partial class SimpleSetting : UserControl
{
public SimpleSetting()
{
this.InitializeComponent();
}
private void btnBack_Click(object sender, RoutedEventArgs e)
{
if (this.Parent.GetType() == typeof(Popup))
{
((Popup)this.Parent).IsOpen = false;
}
SettingsPane.Show();
}
}
}
在首页的MainPage 页面里面:
///
/// Invoked when this page is about to be displayed in a Frame.
///
/// Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
SettingsPane.Show();
}
private void HandleSizeChange(object sender, RoutedEventArgs e)
{
RadioButton rb = sender as RadioButton;
_settingsWidth = Convert.ToInt32(rb.Content);
}
}