Ejemplo n.º 1
0
        private static void IsPopupOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NavigationPaneExpander expander = (NavigationPaneExpander)d;
            bool newValue = (bool)e.NewValue;
            bool oldValue = !newValue;

            // todo: implement automation
            //ComboBoxAutomationPeer peer = UIElementAutomationPeer.FromElement(element) as ComboBoxAutomationPeer;
            //if (peer != null)
            //{
            // peer.RaiseExpandCollapseAutomationEvent(oldValue, newValue);
            //}

            if (newValue)
            {
                if (expander.part_popup != null)
                {
                    expander.popupResizer = new PopupResizer(expander.part_popup, expander.part_contentHost, expander.PopupResizePreviewStyle);
                }
                expander.OnPopupOpened();
            }
            else
            {
                expander.OnPopupClosed();
                if (expander.popupResizer != null)
                {
                    expander.popupResizer.Dispose();
                }
                expander.popupResizer = null;
            }
        }
Ejemplo n.º 2
0
        private void SwitchContentToPopUp(bool minimized)
        {
            //Application.Current.Dispatcher.BeginInvoke((SetMinimized)((e, m) =>
            //{
            NavigationPaneExpander e = this;
            bool m = minimized;

            Border         expanded   = e.part_contentHostContainerExpanded;
            Border         unexpanded = e.part_contentHostContainerUnexpanded;
            ItemsPresenter presenter  = e.part_contentHost;

            if (expanded != null && unexpanded != null && presenter != null)
            {
                if (m)
                {
                    expanded.Child   = null;
                    unexpanded.Child = presenter;
                    //unexpanded.InvalidateVisual();
                }
                else
                {
                    unexpanded.Child = null;
                    expanded.Child   = presenter;
                }
            }
            //}), DispatcherPriority.Render, this, minimized);
        }
Ejemplo n.º 3
0
        private static object CoerceExpandedWidth(DependencyObject d, object value)
        {
            NavigationPaneExpander expander = d as NavigationPaneExpander;

            if (expander.IsMinimized)
            {
                return(expander.widthDelta + expander.part_contentHost.ActualWidth);
            }
            else
            {
                return(expander.ActualWidth);
            }
        }
Ejemplo n.º 4
0
        private static object CoerceIsPopupOpen(DependencyObject d, object value)
        {
            NavigationPaneExpander p = d as NavigationPaneExpander;

            return(p.IsMinimized ? value : false);
        }