Exemplo n.º 1
0
        protected override void CreateChildElements()
        {
            this.arrowButton         = new RadArrowButtonElement();
            this.arrowButton.MinSize = RadDropDownButtonElement.ArrowButtonDefaultSize;
            this.arrowButton.SetValue(DropDownEditorLayoutPanel.IsArrowButtonProperty, true);
            this.arrowButton.Class       = "DropDownButtonArrowButton";
            this.arrowButton.MouseEnter += new EventHandler(arrowButton_MouseEnter);
            this.arrowButton.MouseLeave += new EventHandler(arrowButton_MouseLeave);
            this.arrowButton.Click      += new EventHandler(arrowButton_Click);

            this.actionButton = new ActionButtonElement();
            this.actionButton.BindProperty(RadButtonElement.DisplayStyleProperty, this, RadButtonItem.DisplayStyleProperty, PropertyBindingOptions.OneWay);
            this.actionButton.BindProperty(RadButtonElement.ImageAlignmentProperty, this, RadButtonItem.ImageAlignmentProperty, PropertyBindingOptions.OneWay);
            this.actionButton.BindProperty(RadButtonElement.TextAlignmentProperty, this, RadButtonItem.TextAlignmentProperty, PropertyBindingOptions.OneWay);
            this.actionButton.BindProperty(RadButtonElement.TextImageRelationProperty, this, RadButtonItem.TextImageRelationProperty, PropertyBindingOptions.OneWay);
            this.actionButton.BindProperty(RadButtonElement.TextProperty, this, RadButtonItem.TextProperty, PropertyBindingOptions.TwoWay);
            this.actionButton.BindProperty(RadButtonElement.ImageIndexProperty, this, RadButtonItem.ImageIndexProperty, PropertyBindingOptions.TwoWay);
            this.actionButton.BindProperty(RadButtonElement.ImageProperty, this, RadButtonItem.ImageProperty, PropertyBindingOptions.TwoWay);
            this.actionButton.BindProperty(RadButtonElement.ImageKeyProperty, this, RadButtonItem.ImageKeyProperty, PropertyBindingOptions.TwoWay);
            this.actionButton.SetValue(DropDownEditorLayoutPanel.IsContentProperty, true);
            this.actionButton.MouseLeave += new EventHandler(actionButton_MouseLeave);
            this.actionButton.MouseEnter += new EventHandler(actionButton_MouseEnter);
            this.actionButton.Click      += new EventHandler(actionButton_Click);
            this.actionButton.NotifyParentOnMouseInput = true;

            this.layoutPanel = new DropDownEditorLayoutPanel();
            this.layoutPanel.BindProperty(DropDownEditorLayoutPanel.AutoSizeModeProperty, this, RadDropDownButtonElement.AutoSizeModeProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.Children.Add(this.arrowButton);
            this.layoutPanel.Children.Add(this.actionButton);
            DockLayoutPanel.SetDock(arrowButton, Dock.Right);
            DockLayoutPanel.SetDock(actionButton, Dock.Left);
            layoutPanel.LastChildFill = true;

            this.borderPrimitive = new BorderPrimitive();
            this.borderPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
            this.borderPrimitive.Class        = "DropDownButtonBorder";
            this.Children.Add(this.borderPrimitive);
            this.Children.Add(this.layoutPanel);
        }
Exemplo n.º 2
0
        protected override void CreateChildElements()
        {
            this.filterDropDown                                      = new RadDropDownButtonElement();
            this.filterDropDown.Alignment                            = ContentAlignment.TopLeft;
            this.filterDropDown.ExpandArrowButton                    = true;
            this.filterDropDown.ArrowButton.Arrow.Alignment          = ContentAlignment.MiddleLeft;
            this.filterDropDown.Class                                = "RadGalleryPopupFilterDropDownButton";
            this.filterDropDown.ActionButton.ButtonFillElement.Class = "RadGalleryPopupFilterActionButtonFill";
            this.filterDropDown.ActionButton.BorderElement.Class     = "RadGalleryPopupFilterActionButtonBorder";
            this.filterDropDown.ActionButton.Class                   = "RadGalleryPopupFilterActionButton";
            this.filterDropDown.ArrowButton.Fill.Class               = "RadGalleryPopupFilterArrowButtonFill";
            this.filterDropDown.ArrowButton.Border.Class             = "RadGalleryPopupFilterArrowButtonBorder";
            this.filterDropDown.ArrowButton.Arrow.Class              = "RadGalleryPopupFilterArrowButtonArrow";
            this.filterDropDown.BorderElement.Class                  = "RadGalleryPopupFilterDropDownButtonBorder";

            this.popupGroupsViewport = new RadCanvasViewport();

            this.popupScrollViewer = new RadScrollViewer(this.popupGroupsViewport);
            this.popupScrollViewer.AutoSizeMode          = RadAutoSizeMode.FitToAvailableSize;
            this.popupScrollViewer.HorizontalScrollState = ScrollState.AlwaysHide;
            this.popupScrollViewer.UsePhysicalScrolling  = true;
            this.popupScrollViewer.Class             = "RadGalleryPopupScrollViewer";
            this.popupScrollViewer.FillElement.Class = "RadGalleryPopupScrollViewerFill";

            this.subMenuLayoutPanel           = new RadGalleryMenuLayoutPanel();
            this.subMenuLayoutPanel.Alignment = ContentAlignment.BottomLeft;
            this.subMenuLayoutPanel.Class     = "RadGalleryPoupMenuPanel";

            this.dropDownPanel = new StackLayoutPanel();
            this.dropDownPanel.AutoSizeMode       = RadAutoSizeMode.FitToAvailableSize;
            this.dropDownPanel.Orientation        = System.Windows.Forms.Orientation.Vertical;
            this.dropDownPanel.EqualChildrenWidth = true;

            this.downMenu = new RadGalleryDropDown(this);
            this.WireMenuDropDownEvents();
            this.downMenu.VerticalPopupAlignment   = VerticalPopupAlignment.TopToTop;
            this.downMenu.HorizontalPopupAlignment = HorizontalPopupAlignment.LeftToLeft;
            this.downMenu.AnimationEnabled         = false;

            this.galleryPopupElement = new RadGalleryPopupElement(
                this.Items,
                this.Groups,
                this.Filters,
                this.Tools);
            this.downMenu.PopupElement = this.galleryPopupElement;
            this.downMenu.LoadElementTree();
            this.dropDownPanel.Children.Add(this.filterDropDown);
            this.dropDownPanel.Children.Add(this.popupScrollViewer);
            this.dropDownPanel.Children.Add(this.subMenuLayoutPanel);

            //TODO: perhaps we should implement RadStackViewport to support integral scrolling
            this.inribbonItemsLayoutPanel            = new IntegralScrollWrapPanel();
            this.inribbonItemsLayoutPanel.MaxColumns = this.MaxColumns;
            this.inribbonItemsLayoutPanel.MaxRows    = this.MaxRows;
            this.Items.Owner = this.inribbonItemsLayoutPanel;

            this.upButton                         = new RadImageButtonElement();
            this.upButton.Class                   = "GalleryUpButton";
            this.upButton.Enabled                 = false;
            this.upButton.MinSize                 = arrowButtonsMinSize;
            this.upButton.Click                  += new EventHandler(upButton_Click);
            this.upButton.BorderElement.Class     = "GalleryUpButtonBorder";
            this.upButton.ButtonFillElement.Class = "GalleryArrowButtonFill";

            this.downButton                         = new RadImageButtonElement();
            this.downButton.Class                   = "GalleryDownButton";
            this.downButton.MinSize                 = arrowButtonsMinSize;
            this.downButton.Click                  += new EventHandler(downButton_Click);
            this.downButton.BorderElement.Class     = "GalleryDownButtonBorder";
            this.downButton.ButtonFillElement.Class = "GalleryArrowButtonFill";

            this.popupButton         = new RadImageButtonElement();
            this.popupButton.Class   = "GalleryPopupButtonButton";
            this.popupButton.MinSize = arrowButtonsMinSize;

            this.popupButton.MouseDown              += new System.Windows.Forms.MouseEventHandler(popupButton_MouseDown);
            this.popupButton.BorderElement.Class     = "GalleryPopupButtonButtonBorder";
            this.popupButton.ButtonFillElement.Class = "GalleryArrowButtonFill";

            this.buttonsPanel         = new RadGalleryButtonsLayoutPanel();
            this.buttonsPanel.MaxSize = buttonsPanelMaxSize;
            this.buttonsPanel.SetValue(DropDownEditorLayoutPanel.IsArrowButtonProperty, true);
            this.buttonsPanel.Children.Add(upButton);
            this.buttonsPanel.Children.Add(downButton);
            this.buttonsPanel.Children.Add(popupButton);

            this.inribbonPanel = new DropDownEditorLayoutPanel();
            this.inribbonPanel.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;

            this.inribbonFillPrimitive       = new FillPrimitive();
            this.inribbonFillPrimitive.Class = "InribbonGalleryFill";

            this.inribbonPanel.Children.Add(this.inribbonItemsLayoutPanel);
            this.inribbonPanel.Children.Add(this.buttonsPanel);

            this.inribbonPanelBorder            = new BorderPrimitive();
            this.inribbonPanelBorder.Visibility = ElementVisibility.Collapsed;
            this.inribbonPanelBorder.Class      = "InribbonGalleryBorder";
            this.Children.Add(this.inribbonPanelBorder);
            this.Children.Add(this.inribbonFillPrimitive);
            this.Children.Add(this.inribbonPanel);
        }