Exemple #1
0
        public Flyout(FlyoutType type, object data = null, Flyout parent = null, bool settingsPaneParent = false)
        {
            Parent             = parent;
            SettingsPaneParent = settingsPaneParent;

            // Get bounds
            Rect   WindowBounds  = Window.Current.Bounds;
            double settingsWidth = GetFlyoutWidth(type);

            internalPopup         = new Popup();
            internalPopup.Opened += OnPopupOpened;
            internalPopup.Closed += OnPopupClosed;


            // Popup settings
            internalPopup.IsLightDismissEnabled = true;
            internalPopup.Width  = settingsWidth;
            internalPopup.Height = WindowBounds.Height;

            // Animations
            internalPopup.ChildTransitions = new TransitionCollection();
            internalPopup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left
            });

            // FlyoutControl
            FlyoutControl ctlFlyout = new FlyoutControl(this, type, data);

            ctlFlyout.Width     = settingsWidth;
            ctlFlyout.Height    = WindowBounds.Height;
            internalPopup.Child = ctlFlyout;

            // Popup position
            internalPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (WindowBounds.Width - settingsWidth) : 0);
            internalPopup.SetValue(Canvas.TopProperty, 0);

            Show();

            if (Parent != null)
            {
                Parent.Hide();
            }
        }
Exemple #2
0
        public Flyout(FlyoutType type, object data = null, Flyout parent = null, bool settingsPaneParent = false)
        {
            Parent = parent;
            SettingsPaneParent = settingsPaneParent;

            // Get bounds
            Rect WindowBounds = Window.Current.Bounds;
            double settingsWidth = GetFlyoutWidth(type);

            internalPopup = new Popup();
            internalPopup.Opened += OnPopupOpened;
            internalPopup.Closed += OnPopupClosed;


            // Popup settings
            internalPopup.IsLightDismissEnabled = true;
            internalPopup.Width = settingsWidth;
            internalPopup.Height = WindowBounds.Height;

            // Animations
            internalPopup.ChildTransitions = new TransitionCollection();
            internalPopup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left
            });

            // FlyoutControl
            FlyoutControl ctlFlyout = new FlyoutControl(this, type, data);
            ctlFlyout.Width = settingsWidth;
            ctlFlyout.Height = WindowBounds.Height;
            internalPopup.Child = ctlFlyout;

            // Popup position
            internalPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (WindowBounds.Width - settingsWidth) : 0);
            internalPopup.SetValue(Canvas.TopProperty, 0);

            Show();

            if (Parent != null)
                Parent.Hide();
        }