// Add an event to the settings panel
SettingsPane. GetForCurrentView (). CommandsRequested + = MainPage_CommandsRequested;
// Triggered upon clicking, add a void MainPage_CommandsRequested (SettingsPane sender, javasargs) {// define the Execution Processing Event UICommandInvokedHandler handle = new UICommandInvokedHandler (onSettingsCommand ); // define the SET command item SettingsCommand generalCommand = new SettingsCommand ("generalSettings", "general", handle); // Add the command item to the set args. request. applicationCommands. add (generalCommand );}
// Execute command item event void onSettingsCommand (IUICommand command) {SettingsCommand settingsCommand = (SettingsCommand) command; showBlock. Text = settingsCommand. Label ;}
// Define the popup form private Popup settingsPopup; void onSettingsCommand1 (IUICommand command) {settingsPopup = new Popup ();
// SettingsPopup when popup is disabled. closed + = settingsPopup_Closed; Window. current. activated + = Current_Activated; settingsPopup. isLightDismissEnabled = true; settingsPopup. width = settingsWidth; settingsPopup. height = windowBounds. height; settingsPopup. childTransitions = new TransitionCollection (); settingsPopup. childTransitions. add (new PaneThemeTransition () {Edge = (SettingsPane. edge = SettingsEdgeLocatio N. Right )? EdgeTransitionLocation. right: EdgeTransitionLocation. left}); // Add the user xmal to Popup. SettingsFlyout mypane = new SettingsFlyout (); mypane. width = settingsWidth; mypane. height = windowBounds. height; settingsPopup. child = mypane; settingsPopup. setValue (Canvas. leftProperty, SettingsPane. edge = SettingsEdgeLocation. right? (WindowBounds. Width-settingsWidth): 0); settingsPopup. SetValue (Canvas. TopProperty, 0); settingsPopup. IsOpen = true ;}
void settingsPopup_Closed(object sender, object e) { Window.Current.Activated -= Current_Activated; }
void Current_Activated(object sender, Windows.UI.Core.WindowActivatedEventArgs e) { //throw new NotImplementedException(); if (e.WindowActivationState == Windows.UI.Core.CoreWindowActivationState.Deactivated) { settingsPopup.IsOpen = false; } }