Click here to Skip to main content
Click here to Skip to main content

Tagged as

Add a Settings Panel in Charm Bar – Privacy Policy

, 15 Jan 2013
Rate this:
Please Sign up or sign in to vote.
Add a Settings Panel in Charm Bar.

Charm Bar is a brand new feature of Windows and is seen for the first time, it can be referred to as 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, firstly, 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.

Charm 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, settings include 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 wise instruction on how to add a item in 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 handler during app initialization

SettingsPane.GetForCurrentView().CommandsRequested += OnSettingsPaneCommandRequested;

Step 3 : Add my handler that shows the settings text

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 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. Privacy policy is the major need of app developers these days, they need to add a privacy policy in Settings charm, below 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. Download Source code.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ShubhamSaxena
Software Developer Accenture
India India
I'm Software Engineer Associate at Accenture Services Pvt. Ltd. and I love Microsoft Technologies.
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 15 Jan 2013
Article Copyright 2013 by ShubhamSaxena
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid