locked
how to add new options in settings (charm) in Metro using javascript ? RRS feed

  • Question

  • The documentation in Windows.UI.ApplicationSettings only tells how to show the settings.

    Like maybe :

     WinJS.Utilities.ready(function () {
    
                        $('#p2').click(function () {
                            Windows.UI.ApplicationSettings.SettingsPane.show();
                        });
    
                    });

    Works nice and all that, the problem is i want to add settings : "difficulty", with choice of easy, normal, hard. 

    How ?


    Monday, June 18, 2012 6:04 PM

Answers

  • I totally agree that the documentation is lacking depth.  Some of it seems auto-generated.

    I find the samples are a little better.  Check out http://code.msdn.microsoft.com/windowsapps/.  You can filter down to javascript samples and just search for what you are looking for. 

    In terms of adding an item to the settings pane.  You need to subscribe to the onsettings event and add the application commands object.  I grabbed this from the App Settings sample:  http://code.msdn.microsoft.com/windowsapps/App-settings-sample-1f762f49

      WinJS.Application.onsettings = function (e) { 
                e.detail.applicationcommands = { "help": { title: "Help", href: "/html/2-SettingsFlyout-Help.html" } }; 
                WinJS.UI.SettingsFlyout.populateSettings(e); 
            }; 


    Dave Paquette @Dave_Paquette www.davepaquette.com

    Monday, June 18, 2012 7:21 PM

All replies