Quick Build Windows 8 style application 16-settingcontract principle and construction

Source: Internet
Author: User
Tags building windows

Original: 16-settingcontract principle and construction of fast building Windows 8 style Application

This post mainly introduces Setting contract overview, Setting Contract Implementation fundamentals, how to build Setting contract, build Setting contract best practices.

Setting Contract Overview

1) Setting contract provides a fast, context-sensitive and immersive set-up access experience in current applications;

2) Setting contract is always available;

3) Set up system proxy settings that include always available system settings, allowing users to control the application's access to system devices and features, and the settings specified by the current application;

We can swipe the charms from the right edge of the screen to select the Settings Display Settings window. The Settings window includes both app settings and system settings.

For developers, the entry points in the device panel can be provided via Settingcommand, and these entry points appear at the top of the Setup window, where "permissions" and "comments and scoring"[ Note: Only through Windows App Store approved applications have this entry point] Two entry points are provided by the system . The bottom of the Setup Panel includes the computer settings provided by the system [volume, Brightness, power, and so on].

Setting Contract Implementation Fundamentals

1) Register the commandsrequested event in the Setup Panel;

2) Specify the Settingscommand command in the callback function of the related set event;

3) finally add the Settingscommand command to the applicationcommands so that the command takes effect in the Setup Panel;

How to build setting contract

The basic principle of implementing setting contract is mentioned above, so how do we implement setting contract in our application?

The first step:

Registers the commandsrequested event.

Step Two:

Add the Settingscommand command in the oncommadsreqested callback function, where the constructor in the Settingscommand class contains three parameters.

Three parameters are settingscommandid[set the ID of the command, which is object type],label[Entry point in Control Panel display information], handler[trigger the entry point when the action is taken, The parameter type is Uicommandinvokedhandler].

In the callback function:

When we declare the Settingscommand object to set the handler parameter, you can use a Lambda expression to handle the action that is triggered when the entry is clicked, or you can declare Uicommandinvokedhandler object to set the handler parameter.

Where Uicommandinvokedhandler is required to pass a parameter of type Iuicommand in the delegate object.

The code can be as follows:

Note : We can also declare the settingsflyout object in the click Processing code in an entry point in the Setup Panel, and add a custom control to the object to display in the Control Panel.

The code can be as follows:

We can set the content, Headerbrush, HeaderText and other properties of the settingsflyout object, where Aboutusercontrol is the user-defined control.

We can find the user control and add it in the popup panel by right-clicking the application solution and adding + = Adding a new item .

Then we can set the style and information for the display of the custom control. The code can be as follows:

Step Three:

Add the Settingscommand command to Applicationcommands so that the entry point takes effect in the Setup Panel.

After completing these three steps, we can run our own application to see what's changed in the Setup Panel. Operating effect:

We can see that the two entry points we added are already displayed in the Setup Panel. Click an entry point to perform a pre-set operation.

The content that is set in the custom control is shown in.

Build setting Contract Best Practices

1) Set the relevant characteristics of the application in setting contract;

2) Do not include task flow in Setting contract;

3) Do not add more than four items to the set item;

4) Integration of rarely used setup items;

5) Provide the entrance for the commonly used setting items;

6) Set the hierarchy not to exceed the two poles;

7) When the user changes the settings, the application will be immediately reflected;

8) Provide the same setup experience for the same type of setup;

9) Each setting item should have a concise and easy-to-understand description;

10) Do not use settings to navigate to other parts of the app;

11) The recommended controls in the Setup Panel are: Toggleswitch, Button, Hyperlinkbutton, TextBox, RadioButton, and checkbox;

For more information on the use of setting contract, refer to the Application Settings Guide (Metro style app).

Setting contract Example.

Quick Build Windows 8 style application 16-settingcontract principle and construction

Related Article

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.