protected override void CreateChildElements()
        {
            this.textPrimitive.Class = "GalleryGroupCaption";
            this.textPrimitive.BindProperty(TextPrimitive.TextProperty, this, RadItem.TextProperty, PropertyBindingOptions.OneWay);

            this.captionElement = new FillPrimitive();
            this.captionElement.AutoSizeMode = RadAutoSizeMode.Auto;
            this.captionElement.SetValue(ElementWithCaptionLayoutPanel.CaptionElementProperty, true);
            this.captionElement.Class = "GalleryGroupCaptionFill";
            this.captionElement.Children.Add(textPrimitive);


            this.bodyElement = new FillPrimitive();
            this.bodyElement.AutoSizeMode = RadAutoSizeMode.Auto;
            this.bodyElement.Class        = "GalleryGroupBodyFill";
            this.bodyElement.Padding      = new Padding(2, 2, 2, 0);
            this.bodyElement.Children.Add(this.itemsLayoutPanel);

            this.groupLayoutPanel = new ElementWithCaptionLayoutPanel();
            this.groupLayoutPanel.CaptionOnTop = true;
            this.groupLayoutPanel.Children.Add(captionElement);
            this.groupLayoutPanel.Children.Add(bodyElement);

            this.Children.Add(this.groupLayoutPanel);
        }
        protected override void InitializeFields()
        {
            base.InitializeFields();

            this.itemsLayoutPanel = new WrapLayoutPanel();
            this.textPrimitive    = new TextPrimitive();
            this.captionElement   = new FillPrimitive();
            this.bodyElement      = new FillPrimitive();
            this.groupLayoutPanel = new ElementWithCaptionLayoutPanel();

            this.NotifyParentOnMouseInput = true;
            this.items           = new RadItemOwnerCollection();
            this.items.ItemTypes = new Type[] { typeof(RadGalleryItem) };
        }
        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;
        }
        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);
        }
Exemple #5
0
        protected override void CreateChildElements()
        {
            this.BackColor     = Color.Gray;
            this.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            this.AutoSizeMode  = RadAutoSizeMode.WrapAroundChildren;
            this.Margin        = new Padding(10);
            ElementWithCaptionLayoutPanel layoutPanel = new ElementWithCaptionLayoutPanel();

            layoutPanel.CaptionOnTop = true;

            captionFillPrimitive       = new FillPrimitive();
            captionFillPrimitive.Class = "CaptionFill";
            captionFillPrimitive.ShouldHandleMouseInput = true;
            captionFillPrimitive.AutoSizeMode           = RadAutoSizeMode.Auto;
            //Set higher level of z-order, to allow caption to appear above any inner elements
            captionFillPrimitive.ZIndex = 0;
            captionFillPrimitive.NotifyParentOnMouseInput = true;

            bodyFillPrimitive              = new FillPrimitive();
            bodyFillPrimitive.Class        = "BodyFill";
            bodyFillPrimitive.AutoSizeMode = RadAutoSizeMode.Auto;

            StripLayoutPanel stripPanel = new StripLayoutPanel();

            stripPanel.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            stripPanel.Orientation  = Orientation.Horizontal;

            picturePrimitive = new ImagePrimitive();
            picturePrimitive.BindProperty(ImagePrimitive.ImageProperty, this, BusinessCardElement.PictureProperty, PropertyBindingOptions.OneWay);
            picturePrimitive.Visibility = ElementVisibility.Collapsed;
            picturePrimitive.Margin     = new Padding(10);
            picturePrimitive.MinSize    = new Size(25, 110);
            stripPanel.Children.Add(picturePrimitive);
            this.optionalItems.Add(picturePrimitive);

            StripLayoutPanel textStripPanel = new StripLayoutPanel();

            textStripPanel.Class        = "DetailsPanel";
            textStripPanel.Orientation  = Orientation.Vertical;
            textStripPanel.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            textStripPanel.Padding      = new Padding(5);

            TextPrimitive nameTextPrimitive = new TextPrimitive();

            nameTextPrimitive.Text = "Name";
            nameTextPrimitive.BindProperty(TextPrimitive.TextProperty, this, BusinessCardElement.NameProperty, PropertyBindingOptions.OneWay);
            textStripPanel.Children.Add(nameTextPrimitive);

            TextPrimitive companyTextPrimitive = new TextPrimitive();

            companyTextPrimitive.Text = "Company";
            companyTextPrimitive.BindProperty(TextPrimitive.TextProperty, this, BusinessCardElement.CompanyProperty, PropertyBindingOptions.OneWay);
            textStripPanel.Children.Add(companyTextPrimitive);

            TextPrimitive departmentTextPrimitive = new TextPrimitive();

            departmentTextPrimitive.Text = "Position";
            departmentTextPrimitive.BindProperty(TextPrimitive.TextProperty, this, BusinessCardElement.PositionProperty, PropertyBindingOptions.OneWay);
            departmentTextPrimitive.Visibility = ElementVisibility.Collapsed;
            departmentTextPrimitive.Class      = "DetailsItem";
            textStripPanel.Children.Add(departmentTextPrimitive);
            this.optionalItems.Add(departmentTextPrimitive);

            TextPrimitive phoneTextPrimitive = new TextPrimitive();

            phoneTextPrimitive.Text = "Phone";
            phoneTextPrimitive.BindProperty(TextPrimitive.TextProperty, this, BusinessCardElement.PhoneProperty, PropertyBindingOptions.OneWay);
            phoneTextPrimitive.Visibility = ElementVisibility.Collapsed;
            phoneTextPrimitive.Class      = "DetailsItem";
            textStripPanel.Children.Add(phoneTextPrimitive);
            this.optionalItems.Add(phoneTextPrimitive);

            TextPrimitive faxTextPrimitive = new TextPrimitive();

            faxTextPrimitive.Text = "Fax";
            faxTextPrimitive.BindProperty(TextPrimitive.TextProperty, this, BusinessCardElement.FaxProperty, PropertyBindingOptions.OneWay);
            faxTextPrimitive.Visibility = ElementVisibility.Collapsed;
            faxTextPrimitive.Class      = "DetailsItem";
            textStripPanel.Children.Add(faxTextPrimitive);
            this.optionalItems.Add(faxTextPrimitive);

            TextPrimitive emailTextPrimitive = new TextPrimitive();

            emailTextPrimitive.Text = "E-mail";
            emailTextPrimitive.BindProperty(TextPrimitive.TextProperty, this, BusinessCardElement.EmailProperty, PropertyBindingOptions.OneWay);
            emailTextPrimitive.Visibility = ElementVisibility.Collapsed;
            emailTextPrimitive.Class      = "DetailsItem";
            textStripPanel.Children.Add(emailTextPrimitive);
            this.optionalItems.Add(emailTextPrimitive);

            TextPrimitive addressTextPrimitive = new TextPrimitive();

            addressTextPrimitive.Text = "Address";
            addressTextPrimitive.BindProperty(TextPrimitive.TextProperty, this, BusinessCardElement.AddressProperty, PropertyBindingOptions.OneWay);
            addressTextPrimitive.Visibility = ElementVisibility.Collapsed;
            addressTextPrimitive.Class      = "DetailsItem";
            textStripPanel.Children.Add(addressTextPrimitive);
            this.optionalItems.Add(addressTextPrimitive);

            stripPanel.Children.Add(textStripPanel);
            bodyFillPrimitive.Children.Add(stripPanel);

            captionTextPrimitive      = new TextPrimitive();
            captionTextPrimitive.Text = "Name";
            captionTextPrimitive.Font = new Font(this.Font, FontStyle.Bold);
            captionTextPrimitive.BindProperty(TextPrimitive.TextProperty, this, BusinessCardElement.NameProperty, PropertyBindingOptions.OneWay);
            captionTextPrimitive.MinSize = new Size(120, 10);
            captionFillPrimitive.Children.Add(captionTextPrimitive);

            layoutPanel.Children.Add(captionFillPrimitive);
            captionFillPrimitive.SetValue(ElementWithCaptionLayoutPanel.CaptionElementProperty, true);

            layoutPanel.Children.Add(bodyFillPrimitive);
            this.Children.Add(layoutPanel);

            BorderPrimitive borderPrimitive = new BorderPrimitive();

            borderPrimitive.BorderThickness = new Padding(2);
            this.Children.Add(borderPrimitive);
        }