Ejemplo n.º 1
0
        protected override void UpdateVisualState()
        {
            FrameworkElement mainElement;
            double           width  = (ActualWidth > 2 ? ActualWidth - 0 : 2);
            double           height = (ActualHeight > 2 ? ActualHeight - 0 : 2);
            double           halfHeight;

            if (ElementRoot != null)
            {
                ElementBorder.Width  = width;
                ElementBorder.Height = height;

                halfHeight = height * 0.5;

                mainElement          = (FrameworkElement)Content;
                mainElement.Width    = width;
                mainElement.Height   = height;
                ElementClipping.Rect = new Rect(0, 0, width, height);

                ElementTop.Width = width;

                if (OpenType == RollerOpenType.Scroll)
                {
                    ElementTop.Height    = halfHeight;
                    ElementBottom.Height = halfHeight;
                    ElementBottom.Width  = Width;

                    if (ElementTop.Content != null)
                    {
                        ((FrameworkElement)ElementTop.Content).Width  = Width;
                        ((FrameworkElement)ElementTop.Content).Height = halfHeight;
                    }

                    if (ElementBottom.Content != null)
                    {
                        ElementBottom.SetValue(Canvas.TopProperty, halfHeight);
                        ((FrameworkElement)ElementBottom.Content).Width  = Width;
                        ((FrameworkElement)ElementBottom.Content).Height = halfHeight;
                    }
                }
                else
                {
                    ElementTop.Height = height;
                }
            }
        }
Ejemplo n.º 2
0
        protected override void UpdateVisualState()
        {
            FrameworkElement right;

            base.UpdateVisualState();

            if (ElementRoot != null)
            {
                ElementRight.SetValue(Canvas.LeftProperty, OriginalWidth);
                ElementBottom.SetValue(Canvas.TopProperty, (double)ElementButtons.GetValue(Canvas.TopProperty));

                if (_expandedWidth >= OriginalWidth)
                {
                    ElementRight.Width = _expandedWidth - OriginalWidth;
                }
                else
                {
                    ElementRight.Width = 0;
                }

                ElementRight.Height = Height;

                if (ElementRight.Width < 0d)
                {
                    ElementRight.Width = 0d;
                }

                if (_expandedHeight >= OriginalHeight)
                {
                    ElementBottom.Height = _expandedHeight - OriginalHeight;
                }
                else
                {
                    ElementBottom.Height = 0;
                }

                ElementBottom.Width = Width;

                if (ElementBottom.Height < 0d)
                {
                    ElementBottom.Height = 0d;
                }

                if (ContentRight != null)
                {
                    right = (FrameworkElement)ContentRight;

                    if (_stateRight == State.Normal)
                    {
                        right.SetValue(Canvas.LeftProperty, -ElementRight.Width);
                    }
                    else
                    {
                        right.SetValue(Canvas.LeftProperty, 0d);
                    }

                    right.Width  = ElementRight.Width;
                    right.Height = Height;
                }

                if (ContentBottom != null)
                {
                    right = (FrameworkElement)ContentBottom;

                    if (_stateBottom == State.Normal)
                    {
                        right.SetValue(Canvas.TopProperty, -ElementBottom.Height);
                    }
                    else
                    {
                        right.SetValue(Canvas.TopProperty, 0d);
                    }

                    right.Width  = ElementBottom.Width;
                    right.Height = Height;
                }

                if (_stateRight == State.Expanded)
                {
                    ElementRightClipping.Rect = new Rect(0d, 0d, ElementRight.Width, ElementRight.Height);
                }
                if (_stateBottom == State.Expanded)
                {
                    ElementBottomClipping.Rect = new Rect(0d, 0d, ElementBottom.Width, ElementBottom.Height);
                }
            }
        }