0

I have an requirement that, need to customize the Device charm bar in windows 8?

I need to add a button or any other control in Device charm bar.

  1. Is it possible?
  2. If yes, how can we customize it?

Thanks in advance.

Syed
  • 931
  • 13
  • 28

1 Answers1

0

You can certainly add commands to Device's charms bar like this: I assume you want to add to Settings Charms bar.

Create a Class example AppSettings

public AppSetting()
{
    SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;
    SizeChanged += AppSettingSizeChanged;
}


private void OnCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs)
{
    eventArgs.Request.ApplicationCommands.Clear();

    UICommandInvokedHandler handler = new UICommandInvokedHandler(OnSettingsCommand);

    // Some command
    SettingsCommand someCommand = new SettingsCommand("uniqueID", "NameofLabel", handler);
            eventArgs.Request.ApplicationCommands.Add(someCommand);
}



private void OnSettingsCommand(IUICommand command)
{
    Logger.Log("Called");
    SettingsCommand settingsCommand = (SettingsCommand)command;
    string id =  settingsCommand.Id as string;
    switch (id)
        {
         case someID:
          {
           ShowSomeUI();
          } break;

         case otherID:
          {
           ShowSomeOtherUI();
          } break;
        }
}

    protected void ShowSomeUI()
    {
//Implement anything you want here
    }

Use the above class and make the very first class of your Application inherit from this class so that the commands are added to charms bar and implement anything on their clicks.

P.S let me know if this is not clear or doesnt answer your question.

Suny
  • 1,175
  • 1
  • 10
  • 27
  • Thanks for sharing the code. It is customizing the Settings charm. I need to customize "DEVICE CHARM" bar. – Syed Mar 28 '13 at 13:56