Win 8 自定义设置面版
今日 10 點(diǎn),上海,微軟中國(guó)在 Windows 8 10 月 26 日的全球正式發(fā)布前,帶我們先睹這全新的系統(tǒng)和硬件的魅力所在!
微軟全球 Windows 與 Windows Live 事業(yè)部總裁 Steven Sinofsky 和微軟全球資深副總裁、大中華區(qū)董事長(zhǎng)兼首席執(zhí)行官賀樂賦( Ralph Haupter )共同出席了慶祝活動(dòng)。
漫長(zhǎng)的等待,Win 8 終于快發(fā)布了。期待中。。。
下面是我自己學(xué)習(xí)的Win 8小Sample,為了以后方便學(xué)習(xí),特做一些記錄。
效果如下圖: 右邊添加了三個(gè)命令,分別為:First Custom Command,Second Custom Command,Third Custom Command。
圖1-設(shè)置面版
?
圖2-自定義用戶控件 右邊的控件是用戶自己定義的控件,我這里定義的很簡(jiǎn)單。
?
關(guān)鍵代碼如下:
1、添加命令道設(shè)置面版中. 分別添加了三個(gè)命令。以及三個(gè)命令對(duì)應(yīng)的操作。這里定義的很簡(jiǎn)單,自己可以定義的更復(fù)雜一些。
View Code?
2、顯示設(shè)置面版
private void ShowSettingsPanel(object sender, RoutedEventArgs e){//Show Setting Panel Windows.UI.ApplicationSettings.SettingsPane.Show();}?
3、自定義控件關(guān)鍵代碼:
public sealed partial class SettingPanelUC : UserControl{Popup pop = null;public SettingPanelUC(){this.InitializeComponent();this.Width = 360d;this.Height = Window.Current.Bounds.Height;this.pop = new Popup();this.pop.Child = this;this.pop.IsLightDismissEnabled = true;//Make the user control is on the right.pop.HorizontalOffset = Window.Current.Bounds.Width - this.Width;pop.VerticalOffset = 0d;//Animation for the user control.this.Transitions = new Windows.UI.Xaml.Media.Animation.TransitionCollection();EdgeUIThemeTransition et = new EdgeUIThemeTransition();et.Edge = EdgeTransitionLocation.Right;this.Transitions.Add(et); }/// <summary>/// 顯示控件/// </summary>public void Show(){if (pop != null){pop.IsOpen = true;}}/// <summary>/// 隱藏控件/// </summary>public void Hide(){if (pop != null){pop.IsOpen = false;}}private void Back(object sender, RoutedEventArgs e){this.Hide();Windows.UI.ApplicationSettings.SettingsPane.Show();}}?
總結(jié):Win 8 設(shè)置面版還是挺簡(jiǎn)單的,我這里只是學(xué)習(xí)寫了一些簡(jiǎn)單的東西,并記錄下,方便自己以后再次學(xué)習(xí)。
希望園子里的朋友能多多指教,我也是一名Win 8 初學(xué)者。當(dāng)然,里面的自定義控件的復(fù)雜邏輯還是要靠自己去寫的。
本文轉(zhuǎn)自Work Hard Work Smart博客園博客,原文鏈接:http://www.cnblogs.com/linlf03/archive/2012/10/23/2735450.html,如需轉(zhuǎn)載請(qǐng)自行聯(lián)系原作者
總結(jié)
以上是生活随笔為你收集整理的Win 8 自定义设置面版的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Chromium 组件DotNetBro
- 下一篇: 阿里云ECS主机自定义进程监控