简体   繁体   中英

How to remove commands from SettingsPane - windows 8.1

In search of how to remove the commands from the SettingsPane in Windows 8.1. I don't see it anywhere in the SettingsPane Class documentation in MSDN

Any clues?

Add only needed commands.

In the below code , onCommandsRequested will be fired every time when SettingsPane is opened . You can check conditions before adding commands.

    SettingsPane.GetForCurrentView().CommandsRequested += onCommandsRequested;

Alos, close and reopen the settings pane If you want to change the command when SettingsPane is open. I dont think there is other ways to achieve the same

I found it! :) We can remove commands like this

void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
        args.Request.ApplicationCommands.Clear();
        // or
        args.Request.ApplicationCommands.RemoveAt(0);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM