"Miles Journey--windows App development" app settings and app Help

Source: Internet
Author: User

"Settings" contract

In the previous section, we learned how to save app settings locally by adding setting options within the app, and here's another way. Microsoft calls it a "setup" contract, and all Windows Store apps will automatically mate with that contract. But the app comes with a setup that doesn't work if you don't make any changes. And we add these settings to make the app more personal.

Settingsflyout

First create a new Settingsflyout page, perhaps a lot of children's shoes will be like I learned this as soon as the debugging program wait to see what this setting is like, but now still can't use OH.

As shown below, we can modify the Iconsource to change the icon in the settings.

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

<StackPanel verticalalignment= "Stretch"horizontalalignment=" Stretch " Orientation=" Vertical ">      <StackPanel Orientation="Vertical" >         <TextBlock Text="Big Car's Beautiful Day" FontSize=" Foreground" ="Red" Margin="/> "         <textblock  Text  =< Span class= "Hljs-value" > "buying a big car will make your life vibrant and passionate!" " fontsize  ="  " margin  = "all"   textwrapping  = "Wrap"  foreground  = "Black" />          <TextBlock Text="If you want to buy the words can be sent directly [email protected]" FontSize=" Margin="Foreground" = "Gold" textwrapping="Wrap"/>       </StackPanel>    <StackPanel Orientation= "Vertical" Margin="8">          <toggleswitch  x:Name  = "toggleSwitch1"  header  =" update the latest pictures of big car daily " oncontent  =" on " offcontent  =" Off " toggled  =/>          <toggleswitch x:name="ToggleSwitch2" Header="Push related updates to me"  Oncontent="On" offcontent= "Off" toggled="toggleswitch_toggled"  IsOn="True"/>     </StackPanel>     <StackPanel Orientation= "Vertical" Margin="0,12,0,12" >         <button Content="Praise the Application Bai" Margin="/> "         <button Content="Clear all Caches" Margin="/> "    </StackPanel></StackPanel>
App.xaml.cs

First add the following namespace in App.xaml.cs, and the following 3 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 (NewSettingscommand ("Bigcarmainsettings","Big Car's main setting", (handler) = Showcustomsettingflyout ()));} Public void Showcustomsettingflyout() {Bigcarsettings customsettingflyout =NewBigcarsettings (); Customsettingflyout.show ();}

Of course, the last thing to do in those controls is to add them in the background code, just like the previous blog post, to save the settings.

The above is about the application settings of the same content, and the application of help, and these are the same AH. It's good to create the same goal. And then modify it in XAML to look like it. And as with the app settings, we can also set the app bar at the bottom, the content of the app bar can be accessed here: "Miles Journey--windows App development" app bar.

protected  override  Span class= "Hljs-keyword" >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 ();} 

This blog content is also simple, look at the picture and code should be no problem, then first. Goodbye to the next article!

"Miles Journey--windows App development" app settings and app Help

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.