[Wanli journey-Windows App development] application settings and application help, journey app

Source: Internet
Author: User

[Wanli journey-Windows App development] application settings and application help, journey app
"Set" Contract

In the previous section, we learned how to save the application settings to the local device. In this way, you can add the setting options in the App. Here is another method. Microsoft calls it a "set" contract, and all Windows App Store applications will automatically cooperate with this contract. However, the settings provided by the application are useless if they are not modified. However, we can add these settings to make the application more personalized.

SettingsFlyout

First, create a SettingsFlyout page. Maybe many children's shoes will debug the program as soon as I learned it and wait to see what the setting looks like, but it cannot be used now.

As shown in the following figure, you can modify IconSource to change the icon in "Settings.

Then I set the layout of the settings interface as follows.

<StackPanel verticalignment = "Stretch" HorizontalAlignment = "Stretch" Orientation = "Vertical"> <StackPanel Orientation = "Vertical"> <TextBlock Text = "Big Car" FontSize =" 28 "Foreground =" Red "Margin =" 12 "/> <TextBlock Text =" purchasing a Big Car will make your life dynamic, passionate! "FontSize =" 20 "Margin =" 12 "TextWrapping =" Wrap "Foreground =" Black "/> <TextBlock Text =" send an email directly to the nomasp@outlook.com if you want to buy "FontSize =" 20 "Margin =" 12 "Foreground =" Gold "TextWrapping =" Wrap "/> </StackPanel> <StackPanel Orientation =" Vertical "Margin =" 8 "> <ToggleSwitch x: name = "toggleSwitch1" Header = "update the latest Big Car image" OnContent = "On" OffContent = "Off" Toggled = "ToggleSwitch_Toggled"/> <ToggleSwitch x: name = "toggleSwitch2" Header = "Push related dynamics to me" OnContent = "On" OffContent = "Off" Toggled = "ToggleSwitch_Toggled" IsOn = "True"/> </StackPanel> <StackPanel Orientation = "Vertical" Margin = "0, 12, "> <Button Content =" Praise the application "Margin =" 12 "/> <Button Content =" Clear all caches "Margin =" 12 "/> </StackPanel> </StackPanel>
App. xaml. cs

Add the following namespace in app. xaml. cs and the following three methods:

using Windows.UI.ApplicationSettings;
Protected override void OnWindowCreated (WindowCreatedEventArgs args) {SettingsPane. getForCurrentView (). commandsRequested + = OnCommandsRequested;} private void OnCommandsRequested (SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) {args. request. applicationCommands. add (new SettingsCommand ("BigCarMainSettings", "main settings of Big Car", (handler) => ShowCustomSettingFlyout ();} public void ShowCustomSettingFlyout () {BigCarSettings CustomSettingFlyout = new BigCarSettings (); CustomSettingFlyout. show ();}

Of course, the last click in those controls should be added in the background code, just like the previous blog to save the settings.

The above is the same content about application settings, and application help is the same as this. Just create the same target. Then modify it to your favorite style in XAML. In addition, we can also set the App bar at the bottom of the application settings. For details about the App bar, visit here: [Wanli journey-Windows App development] App bar.

Protected override void OnWindowCreated (WindowCreatedEventArgs args) {SettingsPane. getForCurrentView (). commandsRequested + = OnCommandsRequested;} private void OnCommandsRequested (SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) {args. request. applicationCommands. add (new SettingsCommand ("BigCarHelp", "Big Car help", (handler) => ShowHelpSettingsFlyout ();} public void ShowHelpSettingsFlyout () {BigCarHelphelpSF = new BigCarHelp (); helpSF. show ();}

The content of this blog is still quite simple. It should be okay to look at the images and code. Next, goodbye!

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.