Win 8 custom edition

Source: Internet
Author: User

Before Windows 8 was officially launched around the world at today in Shanghai, Microsoft China showed us the charm of this brand-new system and hardware!

Steven Sinofsky, president of Microsoft's global windows and Windows Live division, and Ralph haupter, Microsoft's senior vice president worldwide and Chairman and CEO of Greater China attended the celebration.

A long wait, win 8 is coming soon. Coming soon...

The following is a small sample of win 8 that I learned by myself. Some records are made for future convenience.

For example, three commands are added to the right: First custom command, second custom command, and third custom command.

Figure 1-set the Panel

 

Figure 2-the control on the right of the Custom User Control is a custom control, which is quite simple here.

 

The key code is as follows:

1. added three commands in the command line Setting panel. And the operations corresponding to the three commands. The definition here is simple, and the definition can be more complicated.

View code

        private void AddCommandToSettingPanel()        {            //Add three command to Setting Panel.            SettingsCommand cmd1 = new SettingsCommand("1", "First Custom Command",                c =>                {                    SettingPanelUC uc = new SettingPanelUC();                    uc.Show();                });            SettingsCommand cmd2 = new SettingsCommand("2", "Second Custom Command",                c =>                {                    ShowMessageTBK.Text = "Second Custom Command Click";                });            SettingsCommand cmd3 = new SettingsCommand("3", "Third Custom Command",                c =>                {                    ShowMessageTBK.Text = "Third Custom Command Click";                });            //Add command in CommandsRequested Event.            SettingsPane.GetForCurrentView().CommandsRequested += (sp, arg) =>            {                arg.Request.ApplicationCommands.Add(cmd1);                arg.Request.ApplicationCommands.Add(cmd2);                arg.Request.ApplicationCommands.Add(cmd3);            };        }

 

2. display the set panel

        private void ShowSettingsPanel(object sender, RoutedEventArgs e)        {            //Show Setting Panel            Windows.UI.ApplicationSettings.SettingsPane.Show();        }

 

3. key code of the custom control:

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. verticaloff Set = 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> // display control /// </Summary> Public void show () {If (pop! = NULL) {Pop. isopen = true ;}/// <summary> // hide the control /// </Summary> Public void hide () {If (pop! = NULL) {Pop. isopen = false;} private void back (Object sender, routedeventargs e) {This. hide (); windows. UI. applicationsettings. settingspane. show ();}}

 

Summary: Windows 8's face-to-face edition is quite simple. I just learned to write something simple and record it so that I can learn it again later.

I hope my friends in the garden can give me more advice. I am also a beginner of win 8. Of course, the complicated logic of the custom controls in it still needs to be written by yourself.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.