コード例 #1
0
        private void CollapseChunkToDropDown()
        {
            this.ExpandElementToStep((int)ChunkVisibilityState.Expanded);

            ExpandableStackLayout.InvalidateAll(this);

            SizeF thisSize = this.DesiredSize;

            this.elementWithCaptionLayoutPanel.SuspendThemeRefresh();
            this.Children.Remove(this.elementWithCaptionLayoutPanel);
            this.elementWithCaptionLayoutPanel.ResumeThemeRefresh();

            RadItem item = new RadItem();

            item.UseNewLayoutSystem = true;
            item.AutoSizeMode       = RadAutoSizeMode.WrapAroundChildren;
            item.Children.Add(this.elementWithCaptionLayoutPanel);
            item.MaxSize = new Size(0, thisSize.ToSize().Height);
            item.MinSize = thisSize.ToSize();
            RadDropDownMenu menu = this.dropDownElement.DropDownMenu;
            //remove left column from Menu
            RadDropDownMenuElement menuPopup = (RadDropDownMenuElement)menu.PopupElement;
            StackLayoutPanel       menuStack = menuPopup.LayoutPanel as StackLayoutPanel;

            Debug.Assert(menuStack != null, "Chunk menu stack is null");
            menuStack.Orientation = this.Orientation;
            menuPopup.Layout.LeftColumnMinWidth = 0;
            this.dropDownElement.Items.Add(item);
            //fix for Missing theme if chunk is not expanded
            this.dropDownElement.Visibility = ElementVisibility.Visible;
            this.CollapseStep = (int)ChunkVisibilityState.Collapsed;
            menu.SetTheme();
            menu.MouseUp += new MouseEventHandler(this.menu_MouseUp);
        }
コード例 #2
0
        protected virtual RadElement CreatePopupElement()
        {
            RadDropDownMenuElement dropDownMenuElement = new RadDropDownMenuElement();

            this.Items.Owner = dropDownMenuElement.LayoutPanel;
            return((RadElement)dropDownMenuElement);
        }
コード例 #3
0
        public override bool OnMouseWheel(Control target, int delta)
        {
            RadDropDownMenuElement element = this.popupElement as RadDropDownMenuElement;

            if (element == null)
            {
                return(false);
            }

            if (element.ScrollPanel.VerticalScrollBar.Visibility != ElementVisibility.Visible)
            {
                return(false);
            }

            if (delta > 0)
            {
                element.ScrollPanel.LineUp();
            }
            else
            {
                element.ScrollPanel.LineDown();
            }

            return(true);
        }
コード例 #4
0
        protected override void OnChildrenChanged(RadElement child, ItemsChangeOperation changeOperation)
        {
            base.OnChildrenChanged(child, changeOperation);

            RadDropDownMenuElement menuElement = this.FindAncestor <RadDropDownMenuElement>();

            if (menuElement == null)
            {
                return;
            }

            if (changeOperation == ItemsChangeOperation.Inserted || changeOperation == ItemsChangeOperation.Set)
            {
                DropDownPosition position = (DropDownPosition)menuElement.GetValue(RadDropDownMenuElement.DropDownPositionProperty);
                foreach (RadElement element in child.ChildrenHierarchy)
                {
                    element.SetValue(RadDropDownMenuElement.DropDownPositionProperty, position);
                }
            }

            //This is needed after adding the scrolling support in RadDropDownMenuElement.
            //since when adding items the scroll layout panel does not invalidate its parent's layout
            //and thus wrong size of the RadDropDownMenu is calculated, we need to invalidate the
            //main element's layout explicitly to force recalculation of the popup's size.
            //This behavior is needed only when adding items in design mode.
            menuElement.InvalidateMeasure();
        }
コード例 #5
0
        protected override void OnChildrenChanged(
            RadElement child,
            ItemsChangeOperation changeOperation)
        {
            base.OnChildrenChanged(child, changeOperation);
            RadDropDownMenuElement ancestor = this.FindAncestor <RadDropDownMenuElement>();

            if (ancestor == null)
            {
                return;
            }
            if (changeOperation == ItemsChangeOperation.Inserted || changeOperation == ItemsChangeOperation.Set)
            {
                DropDownPosition dropDownPosition = (DropDownPosition)ancestor.GetValue(RadDropDownMenuElement.DropDownPositionProperty);
                foreach (RadObject radObject in child.ChildrenHierarchy)
                {
                    int num = (int)radObject.SetValue(RadDropDownMenuElement.DropDownPositionProperty, (object)dropDownPosition);
                }
            }
            ancestor.InvalidateMeasure();
        }
コード例 #6
0
        private void CollapseChunkToDropDown()
        {
            this.ExpandElementToStep(1);
            ExpandableStackLayout.InvalidateAll((RadElement)this);
            this.UpdateLayout();
            SizeF size = (SizeF)this.Size;

            this.elementWithCaptionLayoutPanel.SuspendThemeRefresh();
            this.Children.Remove((RadElement)this.elementWithCaptionLayoutPanel);
            this.elementWithCaptionLayoutPanel.ResumeThemeRefresh();
            RadRibbonBarGroup.RadGroupItem radGroupItem = new RadRibbonBarGroup.RadGroupItem();
            radGroupItem.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            radGroupItem.Children.Add((RadElement)this.elementWithCaptionLayoutPanel);
            radGroupItem.MinSize = new Size(size.ToSize().Width, radGroupItem.MinSize.Height);
            RadDropDownMenu        dropDownMenu = this.dropDownElement.DropDownMenu;
            RadDropDownMenuElement popupElement = (RadDropDownMenuElement)dropDownMenu.PopupElement;

            (popupElement.LayoutPanel as StackLayoutPanel).Orientation = this.Orientation;
            popupElement.Layout.LeftColumnMinWidth = 0;
            this.dropDownElement.Items.Add((RadItem)radGroupItem);
            this.dropDownElement.Visibility = ElementVisibility.Visible;
            this.CollapseStep = 4;
            dropDownMenu.SetTheme();
        }
コード例 #7
0
        protected override void CreateChildElements()
        {
            this.borderPrimitive              = new BorderPrimitive();
            this.borderPrimitive.Class        = "RibbonBarChunkBorder";
            this.borderPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;

            this.groupFill        = new FillPrimitive();
            this.groupFill.Class  = "RibbonBarGroupMainFill";
            this.groupFill.ZIndex = -1;
            this.groupFill.SetDefaultValueOverride(FillPrimitive.BackColorProperty, Color.Transparent);
            this.groupFill.SetDefaultValueOverride(FillPrimitive.GradientStyleProperty, GradientStyles.Solid);

            this.textPrimitive = new TextPrimitive();
            this.textPrimitive.RadPropertyChanged += new RadPropertyChangedEventHandler(this.textPrimitive_RadPropertyChanged);
            this.textPrimitive.BindProperty(TextPrimitive.TextProperty, this, RadRibbonBarGroup.TextProperty, PropertyBindingOptions.TwoWay);
            this.textPrimitive.Class           = "RibbonBarChunkCaption";
            this.textPrimitive.Alignment       = ContentAlignment.MiddleCenter;
            this.textPrimitive.Padding         = new Padding(0);
            this.elementWithCaptionLayoutPanel = new ElementWithCaptionLayoutPanel();

            DockLayoutPanel dockLayout = new DockLayoutPanel();

            this.captionElementFill = new FillPrimitive();
            this.captionElementFill.AutoSizeMode = RadAutoSizeMode.Auto;
            this.captionElementFill.SetValue(ElementWithCaptionLayoutPanel.CaptionElementProperty, true);
            this.captionElementFill.Class = "ChunkCaptionFill";

            this.captionElementFill.Children.Add(dockLayout);

            //add DialogButton
            //PP 14/09/2007
            this.dialogButton         = new RadButtonElement();
            this.dialogButton.Padding = new Padding(0, 3, 0, 0);

            this.dialogButton.SetDefaultValueOverride(RadButtonItem.ImageProperty,
                                                      ResourceHelper.ImageFromResource(typeof(RadRibbonBarGroup), "Telerik.WinControls.UI.Resources.RibbonDialogButton.png"));
            this.dialogButton.Alignment  = ContentAlignment.BottomRight;
            this.dialogButton.Visibility = ElementVisibility.Collapsed;
            this.dialogButton.Class      = "DialogButtonClass";
            this.dialogButton.SetValue(DockLayoutPanel.DockProperty, Dock.Right);
            dockLayout.Children.Add(this.dialogButton);

            //end add
            dockLayout.Children.Add(this.textPrimitive);
            dockLayout.LastChildFill = true;
            elementWithCaptionLayoutPanel.Children.Add(this.captionElementFill);
            FillPrimitive bodyElementFill = new FillPrimitive();

            bodyElementFill.AutoSizeMode = RadAutoSizeMode.Auto;
            bodyElementFill.Class        = "ChunkBodyFill";
            bodyElementFill.Padding      = new Padding(2, 2, 2, 0);
            BorderPrimitive bodyBorder = new BorderPrimitive();

            bodyBorder.Class         = "BodyBorder";
            bodyBorder.AutoSizeMode  = RadAutoSizeMode.FitToAvailableSize;
            bodyBorder.GradientStyle = GradientStyles.Linear;
            bodyBorder.ForeColor     = Color.Transparent;
            bodyBorder.ForeColor2    = Color.White;
            bodyBorder.ForeColor3    = Color.White;
            bodyBorder.ForeColor4    = Color.White;
            bodyElementFill.Children.Add(bodyBorder);
            this.stackLayoutPanel       = new StackLayoutPanel();
            this.stackLayoutPanel.Class = "Test";//remove this - only for tests
            this.elementWithCaptionLayoutPanel.Children.Add(bodyElementFill);
            bodyElementFill.Children.Add(this.stackLayoutPanel);
            this.dropDownElement = new RadRibbonBarGroupDropDownButtonElement();
            this.dropDownElement.DropDownInheritsThemeClassName = true;
            this.dropDownElement.Visibility         = ElementVisibility.Collapsed;
            this.dropDownElement.ActionButton.Shape = new RoundRectShape(4);
            //this.dropDownElement.DropDownMenu.RootElement.ApplyShapeToControl = true;
            //this.dropDownElement.DropDownMenu.RootElement.Shape = new RoundRectShape(4);
            this.dropDownElement.BorderElement.Class      = "GroupDropDownButtonBorder";
            this.dropDownElement.BorderElement.Visibility = ElementVisibility.Collapsed;

            //As of Q1 2010, theme support for the group's popup border and fill
            RadDropDownMenuElement element = this.dropDownElement.DropDownMenu.PopupElement as RadDropDownMenuElement;

            element.Fill.Class   = "RibbonBarGroupDropDownFill";
            element.Border.Class = "RibbonBarGroupDropDownBorder";
            element.Class        = "RibbonBarGroupDropDownElement";
            this.dropDownElement.DropDownMenu.RootElement.Class = "RibbonBarGroupDropDownRoot";
            //

            FillPrimitive dropDownFill = new FillPrimitive();

            dropDownFill.Visibility = ElementVisibility.Collapsed;
            dropDownFill.Class      = "ChunkBodyFill";
            dropDownElement.DropDownMenu.RootElement.Children.Add(dropDownFill);

            this.dropDownElement.Image             = ResourceHelper.ImageFromResource(typeof(RadRibbonBarGroup), "Telerik.WinControls.UI.Resources.dropDown.png");
            this.dropDownElement.DisplayStyle      = DisplayStyle.ImageAndText;
            this.dropDownElement.TextImageRelation = TextImageRelation.ImageAboveText;
            this.dropDownElement.ShowArrow         = false;
            this.dropDownElement.Margin            = new Padding(4, 4, 4, 4);
            this.dropDownElement.ActionButton.BorderElement.Visibility = ElementVisibility.Hidden;
            this.dropDownElement.ActionButton.BorderElement.Class      = "GroupDropDownButtonInnerBorder";
            this.dropDownElement.ActionButton.Padding = new Padding(4, 10, 4, 28);
            this.dropDownElement.BindProperty(RadDropDownButtonElement.TextProperty, this, RadRibbonBarGroup.TextProperty, PropertyBindingOptions.OneWay);
            this.Children.Add(this.dropDownElement);
            this.dropDownElement.ImageAlignment = ContentAlignment.MiddleCenter;
            this.dropDownElement.ThemeRole      = "RibbonGroupDropDownButton";
            this.Children.Add(this.elementWithCaptionLayoutPanel);
            this.Children.Add(this.borderPrimitive);
            this.Children.Add(this.groupFill);
            this.items.Owner         = this.stackLayoutPanel;
            this.items.ItemsChanged += this.ItemChanged;
        }
コード例 #8
0
        protected override void CreateChildElements()
        {
            this.borderPrimitive              = new BorderPrimitive();
            this.borderPrimitive.Class        = "RibbonBarChunkBorder";
            this.borderPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
            this.groupFill        = new FillPrimitive();
            this.groupFill.Class  = "RibbonBarGroupMainFill";
            this.groupFill.ZIndex = -1;
            int num1 = (int)this.groupFill.SetDefaultValueOverride(VisualElement.BackColorProperty, (object)Color.Transparent);
            int num2 = (int)this.groupFill.SetDefaultValueOverride(FillPrimitive.GradientStyleProperty, (object)GradientStyles.Solid);

            this.textPrimitive = new TextPrimitive();
            this.textPrimitive.RadPropertyChanged += new RadPropertyChangedEventHandler(this.textPrimitive_RadPropertyChanged);
            int num3 = (int)this.textPrimitive.BindProperty(TextPrimitive.TextProperty, (RadObject)this, RadItem.TextProperty, PropertyBindingOptions.TwoWay);

            this.textPrimitive.Class           = "RibbonBarChunkCaption";
            this.textPrimitive.Alignment       = ContentAlignment.MiddleCenter;
            this.textPrimitive.Padding         = new Padding(0);
            this.elementWithCaptionLayoutPanel = new ElementWithCaptionLayoutPanel();
            DockLayoutPanel dockLayoutPanel = new DockLayoutPanel();

            this.captionElementFill = new FillPrimitive();
            this.captionElementFill.AutoSizeMode = RadAutoSizeMode.Auto;
            int num4 = (int)this.captionElementFill.SetValue(ElementWithCaptionLayoutPanel.CaptionElementProperty, (object)true);

            this.captionElementFill.Class = "ChunkCaptionFill";
            this.captionElementFill.Children.Add((RadElement)dockLayoutPanel);
            this.dialogButton         = new RadButtonElement();
            this.dialogButton.Padding = new Padding(0, 3, 0, 0);
            int num5 = (int)this.dialogButton.SetDefaultValueOverride(RadButtonItem.ImageProperty, (object)Telerik.WinControls.ResourceHelper.ImageFromResource(typeof(RadRibbonBarGroup), "Telerik.WinControls.UI.Resources.RibbonDialogButton.png"));

            this.dialogButton.Alignment  = ContentAlignment.BottomRight;
            this.dialogButton.Visibility = ElementVisibility.Collapsed;
            this.dialogButton.Class      = "DialogButtonClass";
            int num6 = (int)this.dialogButton.SetValue(DockLayoutPanel.DockProperty, (object)Dock.Right);

            dockLayoutPanel.Children.Add((RadElement)this.dialogButton);
            dockLayoutPanel.Children.Add((RadElement)this.textPrimitive);
            dockLayoutPanel.LastChildFill = true;
            this.elementWithCaptionLayoutPanel.Children.Add((RadElement)this.captionElementFill);
            this.bodyElementFill = new FillPrimitive();
            this.bodyElementFill.AutoSizeMode = RadAutoSizeMode.Auto;
            this.bodyElementFill.Class        = "ChunkBodyFill";
            this.bodyElementFill.Padding      = new Padding(2, 2, 2, 0);
            BorderPrimitive borderPrimitive = new BorderPrimitive();

            borderPrimitive.Class         = "BodyBorder";
            borderPrimitive.AutoSizeMode  = RadAutoSizeMode.FitToAvailableSize;
            borderPrimitive.GradientStyle = GradientStyles.Linear;
            borderPrimitive.ForeColor     = Color.Transparent;
            borderPrimitive.ForeColor2    = Color.White;
            borderPrimitive.ForeColor3    = Color.White;
            borderPrimitive.ForeColor4    = Color.White;
            this.bodyElementFill.Children.Add((RadElement)borderPrimitive);
            this.stackLayoutPanel = new StackLayoutPanel();
            this.elementWithCaptionLayoutPanel.Children.Add((RadElement)this.bodyElementFill);
            this.bodyElementFill.Children.Add((RadElement)this.stackLayoutPanel);
            this.dropDownElement = (RadDropDownButtonElement) new RadRibbonBarGroupDropDownButtonElement();
            this.dropDownElement.DropDownInheritsThemeClassName = true;
            this.dropDownElement.Visibility               = ElementVisibility.Collapsed;
            this.dropDownElement.ActionButton.Shape       = (ElementShape) new RoundRectShape(4);
            this.dropDownElement.BorderElement.Class      = "GroupDropDownButtonBorder";
            this.dropDownElement.BorderElement.Visibility = ElementVisibility.Collapsed;
            RadDropDownMenuElement popupElement = this.dropDownElement.DropDownMenu.PopupElement as RadDropDownMenuElement;

            popupElement.Fill.Class   = "RibbonBarGroupDropDownFill";
            popupElement.Border.Class = "RibbonBarGroupDropDownBorder";
            popupElement.Class        = "RibbonBarGroupDropDownElement";
            this.dropDownElement.DropDownMenu.RootElement.Class = "RibbonBarGroupDropDownRoot";
            FillPrimitive fillPrimitive = new FillPrimitive();

            fillPrimitive.Visibility = ElementVisibility.Collapsed;
            fillPrimitive.Class      = "ChunkBodyFill";
            this.dropDownElement.DropDownMenu.RootElement.Children.Add((RadElement)fillPrimitive);
            this.dropDownElement.Image             = (Image)Telerik.WinControls.ResourceHelper.ImageFromResource(typeof(RadRibbonBarGroup), "Telerik.WinControls.UI.Resources.dropDown.png");
            this.dropDownElement.DisplayStyle      = DisplayStyle.ImageAndText;
            this.dropDownElement.TextImageRelation = TextImageRelation.ImageAboveText;
            this.dropDownElement.ShowArrow         = false;
            this.dropDownElement.Margin            = new Padding(4, 4, 4, 4);
            this.dropDownElement.ActionButton.BorderElement.Visibility = ElementVisibility.Hidden;
            this.dropDownElement.ActionButton.BorderElement.Class      = "GroupDropDownButtonInnerBorder";
            this.dropDownElement.ActionButton.Padding = new Padding(4, 10, 4, 28);
            int num7 = (int)this.dropDownElement.BindProperty(RadItem.TextProperty, (RadObject)this, RadItem.TextProperty, PropertyBindingOptions.OneWay);

            this.dropDownElement.DropDownOpening += new CancelEventHandler(this.dropDownElement_DropDownOpening);
            this.Children.Add((RadElement)this.dropDownElement);
            this.dropDownElement.ImageAlignment = ContentAlignment.MiddleCenter;
            this.dropDownElement.ThemeRole      = "RibbonGroupDropDownButton";
            this.Children.Add((RadElement)this.elementWithCaptionLayoutPanel);
            this.Children.Add((RadElement)this.borderPrimitive);
            this.Children.Add((RadElement)this.groupFill);
            this.items.Owner         = (RadElement)this.stackLayoutPanel;
            this.items.ItemsChanged += new ItemChangedDelegate(this.ItemChanged);
        }