Example #1
0
        // This is the container that will hold our custom content.

        /// <summary>
        ///     This the event handler for the "Defaults" button added to the settings charm. This method
        ///     is responsible for creating the Popup window will use as the container for our settings Flyout.
        ///     The reason we use a Popup is that it gives us the "light dismiss" behavior that when a user clicks away
        ///     from our custom UI it just dismisses.  This is a principle in the Settings experience and you see the
        ///     same behavior in other experiences like AppBar.
        /// </summary>
        /// <param name="command"></param>
        private void OnSettingsCommand(IUICommand command)
        {
            // Create a Popup window which will contain our flyout.
            settingsPopup                       = new Popup();
            settingsPopup.Closed               += OnPopupClosed;
            Window.Current.Activated           += OnWindowActivated;
            settingsPopup.IsLightDismissEnabled = true;
            settingsPopup.Width                 = settingsWidth;
            settingsPopup.Height                = windowBounds.Height;

            // Add the proper animation for the panel.
            settingsPopup.ChildTransitions = new TransitionCollection();
            settingsPopup.ChildTransitions.Add(
                new PaneThemeTransition
            {
                Edge =
                    (SettingsPane.Edge == SettingsEdgeLocation.Right)
                                ? EdgeTransitionLocation.Right
                                : EdgeTransitionLocation.Left
            });

            // Create a SettingsFlyout the same dimenssions as the Popup.
            var mypane = new SettingsFlyout();

            mypane.Width  = settingsWidth;
            mypane.Height = windowBounds.Height;

            // Place the SettingsFlyout inside our Popup window.
            settingsPopup.Child = mypane;

            // Let's define the location of our Popup.
            settingsPopup.SetValue(
                Canvas.LeftProperty,
                SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0);
            settingsPopup.SetValue(Canvas.TopProperty, 0);
            settingsPopup.IsOpen = true;
        }
        // This is the container that will hold our custom content.

        /// <summary>
        ///     This the event handler for the "Defaults" button added to the settings charm. This method
        ///     is responsible for creating the Popup window will use as the container for our settings Flyout.
        ///     The reason we use a Popup is that it gives us the "light dismiss" behavior that when a user clicks away
        ///     from our custom UI it just dismisses.  This is a principle in the Settings experience and you see the
        ///     same behavior in other experiences like AppBar.
        /// </summary>
        /// <param name="command"></param>
        private void OnSettingsCommand(IUICommand command)
        {
            // Create a Popup window which will contain our flyout.
            settingsPopup = new Popup();
            settingsPopup.Closed += OnPopupClosed;
            Window.Current.Activated += OnWindowActivated;
            settingsPopup.IsLightDismissEnabled = true;
            settingsPopup.Width = settingsWidth;
            settingsPopup.Height = windowBounds.Height;

            // Add the proper animation for the panel.
            settingsPopup.ChildTransitions = new TransitionCollection();
            settingsPopup.ChildTransitions.Add(
                new PaneThemeTransition
                    {
                        Edge =
                            (SettingsPane.Edge == SettingsEdgeLocation.Right)
                                ? EdgeTransitionLocation.Right
                                : EdgeTransitionLocation.Left
                    });

            // Create a SettingsFlyout the same dimenssions as the Popup.
            var mypane = new SettingsFlyout();
            mypane.Width = settingsWidth;
            mypane.Height = windowBounds.Height;

            // Place the SettingsFlyout inside our Popup window.
            settingsPopup.Child = mypane;

            // Let's define the location of our Popup.
            settingsPopup.SetValue(
                Canvas.LeftProperty,
                SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0);
            settingsPopup.SetValue(Canvas.TopProperty, 0);
            settingsPopup.IsOpen = true;
        }