Exemplo n.º 1
0
        public virtual void Expand()
        {
            if (!this.IsCollapsed)
            {
                return;
            }
            CancelEventArgs e = new CancelEventArgs();

            this.OnExpanding(e);
            if (e.Cancel)
            {
                return;
            }
            this.IsCollapsed = false;
            this.ItemContainer.Visibility = ElementVisibility.Visible;
            if (this.GetEffectiveDisplayMode((float)this.Size.Width) == NavigationViewDisplayModes.Expanded)
            {
                if (this.AllowAnimation)
                {
                    Size size1 = new Size(TelerikDpiHelper.ScaleInt(this.CollapsedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0);
                    Size size2 = new Size(TelerikDpiHelper.ScaleInt(this.ExpandedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0);
                    AnimatedPropertySetting animatedPropertySetting = new AnimatedPropertySetting(RadElement.MinSizeProperty, (object)size1, (object)size2, this.AnimationFrames, this.AnimationInterval);
                    animatedPropertySetting.AnimationFinished += (AnimationFinishedEventHandler)((param0, param1) =>
                    {
                        foreach (LightVisualElement lightVisualElement in (IEnumerable <RadPageViewItem>) this.Items)
                        {
                            lightVisualElement.DrawText = true;
                        }
                        this.OnExpanded(EventArgs.Empty);
                    });
                    animatedPropertySetting.ApplyValue((RadObject)this.ItemContainer);
                }
                else
                {
                    this.ItemContainer.MinSize = new Size(TelerikDpiHelper.ScaleInt(this.ExpandedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0);
                    this.OnExpanded(EventArgs.Empty);
                }
            }
            else
            {
                this.PopupStack.Children.Insert(0, (RadElement)this.HamburgerButton);
                if (!this.PopupStack.Children.Contains((RadElement)this.ItemContainer))
                {
                    this.PopupStack.Children.Add((RadElement)this.ItemContainer);
                }
                this.HamburgerButton.Alignment           = this.RightToLeft ? ContentAlignment.TopRight : ContentAlignment.TopLeft;
                this.HamburgerButton.StretchHorizontally = true;
                int num1 = (int)this.ItemContainer.ItemLayout.SetValue(RadPageViewStripElement.StripAlignmentProperty, (object)StripViewAlignment.Right);
                int num2 = (int)this.ItemContainer.ResetValue(RadElement.MinSizeProperty, ValueResetFlags.Animation);
                this.ItemContainer.MinSize = new Size(TelerikDpiHelper.ScaleInt(this.ExpandedPaneWidth, new SizeF(1f / this.DpiScaleFactor.Width, 0.0f)), 0);
                this.ItemContainer.MaxSize = Size.Empty;
                foreach (LightVisualElement lightVisualElement in (IEnumerable <RadPageViewItem>) this.Items)
                {
                    lightVisualElement.DrawText = true;
                }
                if (this.Popup.ElementTree.RootElement.ElementState != ElementState.Loaded)
                {
                    this.Popup.LoadElementTree(new Size(this.ExpandedPaneWidth, (int)this.DesiredSize.Height));
                }
                RadPageViewNavigationViewElement.ApplyThemeToPopup((RadElementTree)this.ElementTree, this.Popup);
                this.Popup.Size = new Size(this.ExpandedPaneWidth, (int)this.DesiredSize.Height);
                this.Popup.DropDownAnimationDirection = this.RightToLeft ? RadDirection.Left : RadDirection.Right;
                this.Popup.HorizontalPopupAlignment   = this.RightToLeft ? HorizontalPopupAlignment.RightToRight : HorizontalPopupAlignment.LeftToLeft;
                this.Popup.VerticalPopupAlignment     = VerticalPopupAlignment.TopToBottom;
                this.Popup.RootElement.BackColor      = this.BackColor;
                this.Popup.Show(this.PointToScreen(this.RightToLeft ? new Point(this.Bounds.Right, this.Bounds.Top) : new Point(this.Bounds.Left, this.Bounds.Top)));
                this.OnExpanded(EventArgs.Empty);
            }
        }
Exemplo n.º 2
0
 public HamburgerButtonElement(
     RadPageViewNavigationViewElement navigationViewElement)
 {
     this.navigationViewElement = navigationViewElement;
 }