Add a Settings Panel in Charm Bar in Windows 8 - Privacy Policy

Add a Settings Panel in Charm Bar in Windows 8 - Privacy Policy

This article is also published in http://www.c-sharpcorner.com/UploadFile/shubham0987/add-a-settings-panel-in-charm-bar-in-windows-8-privacy-pol/


The Charm Bar is a brand new feature of Windows and is seen for the first time, it can be referred to as a universal toolbar and thus you can access it from anywhere no matter which application you are working on. The two ways in which you can access the Charm Bar is, first, by dragging your mouse pointer to the top or bottom right corner of the screen (since the show desktop thing is also at the bottom right, I prefer the top right corner). You can alternatively press the Windows+C button on your computer to invoke the bar.



The Settings charm provides a single access point to all settings that are relevant in the user's current context. The Settings charm is always available. Regardless of context, the settings includes system settings that always apply, system-brokered settings that enable users to control an app's access to system devices and capabilities, and settings that are specified by the current app.

I will show you a step-by-step instructions for how to add an item to the settings charm bar.

Step 1

Add the Following Namespaces:


using Windows.UI.ApplicationSettings; 
using Windows.UI.Popups;

Step 2

Next you need to register for "CommandsRequested" in your page. Add the following handler during app initialization:

SettingsPane.GetForCurrentView().CommandsRequested += OnSettingsPaneCommandRequested;

Step 3

Add my handler that shows the settings text, as in:

private void OnSettingsPaneCommandRequested(SettingsPane sender,SettingsPaneCommandsRequestedEventArgs args)
{
// Add the commands one by one to the settings panel
args.Request.ApplicationCommands.Add(new SettingsCommand("commandID", "Command Name", DoOperation));
}

Step 4

Add the DoOperation method


private void DoOperation(IUICommand command)
{
// Write the logic here that you want to do, when the user clicks it
}

This is all, you are done. The Privacy policy is a major requirement for app developers these days; they need to add a privacy policy in the Settings charm, the following is the DoOperation method for adding a privacy policy:

private async void DoOperation(IUICommand command)
{
Uri uri = new Uri("<insert web url to your privacy policy here>");
await Windows.System.Launcher.LaunchUriAsync(uri);
}

Enjoy. Publish your apps.
Leave a Comment
  • Please add 8 and 6 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Hi

    Could you assist me with the VB.net version of this code. I have been looking for a way to add the Privacy Policy to the Settings charm via a Link to my website but to no avail. All code available does not work.

    Any help will be appreciated

Page 1 of 1 (1 items)