Win8商店程序应用程序栏和设置栏

Posted by baicai on July 4, 2013
SemanticZoom设置缩放视图
 

SettingsPane.GetForCurrentView().CommandsRequested += onCommandsRequested;

 

http://technet.microsoft.com/zh-cn/subscriptions/hh781234

 

private void CreateAppBar()
        {
            this.BottomAppBar = null;
            AppBar bottomBar = new AppBar();
            StackPanel sp = new StackPanel() { Orientation = Orientation.Horizontal };

            Button btn1 = new Button();
            btn1.Content = "设置";
            btn1.Click += btn1_Click;
            sp.Children.Add(btn1);

            bottomBar.Content = sp;
            this.BottomAppBar = bottomBar;
        }

        void btn1_Click(object sender, RoutedEventArgs e)
        {
        }

        void onSettingsCommand(IUICommand command)
        {
            SettingsCommand settingsCommand = (SettingsCommand)command;
            if (settingsCommand.Label == "设置")
            {
            }
        }

        void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs)
        {
            UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand);
            SettingsCommand generalCommand = new SettingsCommand("Setting", "设置", handler);
            eventArgs.Request.ApplicationCommands.Clear();
            eventArgs.Request.ApplicationCommands.Add(generalCommand);
        }