Win 8 自定义设置面版
今日 10 點,上海,微軟中國在 Windows 8 10 月 26 日的全球正式發布前,帶我們先睹這全新的系統和硬件的魅力所在!
微軟全球 Windows 與 Windows Live 事業部總裁 Steven Sinofsky 和微軟全球資深副總裁、大中華區董事長兼首席執行官賀樂賦( Ralph Haupter )共同出席了慶祝活動。
漫長的等待,Win 8 終于快發布了。期待中。。。
下面是我自己學習的Win 8小Sample,為了以后方便學習,特做一些記錄。
效果如下圖: 右邊添加了三個命令,分別為:First Custom Command,Second Custom Command,Third Custom Command。
圖1-設置面版
?
圖2-自定義用戶控件 右邊的控件是用戶自己定義的控件,我這里定義的很簡單。
?
關鍵代碼如下:
1、添加命令道設置面版中. 分別添加了三個命令。以及三個命令對應的操作。這里定義的很簡單,自己可以定義的更復雜一些。
View Code?
2、顯示設置面版
private void ShowSettingsPanel(object sender, RoutedEventArgs e){//Show Setting Panel Windows.UI.ApplicationSettings.SettingsPane.Show();}?
3、自定義控件關鍵代碼:
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();}}?
總結:Win 8 設置面版還是挺簡單的,我這里只是學習寫了一些簡單的東西,并記錄下,方便自己以后再次學習。
希望園子里的朋友能多多指教,我也是一名Win 8 初學者。當然,里面的自定義控件的復雜邏輯還是要靠自己去寫的。
本文轉自Work Hard Work Smart博客園博客,原文鏈接:http://www.cnblogs.com/linlf03/archive/2012/10/23/2735450.html,如需轉載請自行聯系原作者
總結
以上是生活随笔為你收集整理的Win 8 自定义设置面版的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Chromium 组件DotNetBro
- 下一篇: Python startswith()