protected override void CreateChildElements() { fillPrimitive = new FillPrimitive(); fillPrimitive.Class = "GalleryItemSelectionFill"; fillPrimitive.Visibility = ElementVisibility.Hidden; fillPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize; borderPrimitive = new BorderPrimitive(); borderPrimitive.Class = "GalleryItemSelectionBorder"; borderPrimitive.Visibility = ElementVisibility.Hidden; borderPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize; this.imagePrimitive = new ImagePrimitive(); this.imagePrimitive.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, true); this.imagePrimitive.BindProperty(ImagePrimitive.ImageIndexProperty, this, RadGalleryItem.ImageIndexProperty, PropertyBindingOptions.TwoWay); this.imagePrimitive.BindProperty(ImagePrimitive.ImageProperty, this, RadGalleryItem.ImageProperty, PropertyBindingOptions.TwoWay); this.imagePrimitive.BindProperty(ImagePrimitive.ImageKeyProperty, this, RadGalleryItem.ImageKeyProperty, PropertyBindingOptions.TwoWay); textPrimitive = new TextPrimitive(); textPrimitive.Class = "GalleryItemText"; textPrimitive.BindProperty(TextPrimitive.TextProperty, this, RadGalleryItem.TextProperty, PropertyBindingOptions.OneWay); textPrimitive.BindProperty(TextPrimitive.AlignmentProperty, this, RadGalleryItem.TextAlignmentProperty, PropertyBindingOptions.OneWay); this.descriptionTextPrimitive = new TextPrimitive(); this.descriptionTextPrimitive.Class = "GalleryItemDescriptionText"; this.descriptionTextPrimitive.BindProperty(TextPrimitive.FontProperty, this, RadGalleryItem.DescriptionFontProperty, PropertyBindingOptions.OneWay); StackLayoutPanel textPanel = new StackLayoutPanel(); textPanel.Orientation = Orientation.Vertical; textPanel.EqualChildrenWidth = true; textPanel.SetValue(ImageAndTextLayoutPanel.IsTextPrimitiveProperty, true); textPanel.Children.Add(textPrimitive); textPanel.Children.Add(this.descriptionTextPrimitive); this.layoutPanel = new ImageAndTextLayoutPanel(); this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.DisplayStyleProperty, this, RadGalleryItem.DisplayStyleProperty, PropertyBindingOptions.OneWay); this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.ImageAlignmentProperty, this, RadGalleryItem.ImageAlignmentProperty, PropertyBindingOptions.OneWay); this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.TextAlignmentProperty, this, RadGalleryItem.TextAlignmentProperty, PropertyBindingOptions.OneWay); this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.TextImageRelationProperty, this, RadGalleryItem.TextImageRelationProperty, PropertyBindingOptions.OneWay); this.layoutPanel.Children.Add(imagePrimitive); this.layoutPanel.Children.Add(textPanel); this.Children.Add(fillPrimitive); this.Children.Add(borderPrimitive); this.Children.Add(this.layoutPanel); }
protected override void CreateChildElements() { base.CreateChildElements(); this.minMaxCloseButtonsStackLayoutPanel = new StackLayoutPanel(); this.minMaxCloseButtonsStackLayoutPanel.EqualChildrenHeight = true; this.Children.Add(this.minMaxCloseButtonsStackLayoutPanel); this.systemButtons = new StackLayoutPanel(); this.systemButtons.Class = "SystemButtonsStackLayout"; this.systemButtons.Orientation = Orientation.Horizontal; this.systemButtons.Alignment = ContentAlignment.MiddleRight; this.minMaxCloseButtonsStackLayoutPanel.Children.Add(this.systemButtons); this.minimizeButton = new RadImageButtonElement(); this.minimizeButton.StateManager = new RibbonBarSystemButtonStateManager().StateManagerInstance; this.minimizeButton.ThemeRole = "RibbonMinimizeButton"; this.minimizeButton.Class = "MinimizeButton"; this.minimizeButton.Image = Properties.Resources.ribbon_minimize; this.minimizeButton.Click += new EventHandler(this.OnMinimize); ClassSelector selector = new ClassSelector("ButtonFill"); ClassSelector borderSelector = new ClassSelector("ButtonBorder"); selector.GetSelectedElements(this.minimizeButton).First.Value.Class = "CaptionButtonFill"; borderSelector.GetSelectedElements(this.minimizeButton).First.Value.Class = "CaptionButtonBorder"; this.systemButtons.Children.Add(minimizeButton); this.maximizeButton = new RadImageButtonElement(); this.maximizeButton.StateManager = new RibbonBarSystemButtonStateManager().StateManagerInstance; this.maximizeButton.ThemeRole = "RibbonMaximizeButton"; this.maximizeButton.Class = "MaximizeButton"; this.maximizeButton.Image = Properties.Resources.ribbon_maximize; this.maximizeButton.Click += new EventHandler(this.OnMaximizeRestore); selector.GetSelectedElements(this.maximizeButton).First.Value.Class = "CaptionButtonFill"; borderSelector.GetSelectedElements(this.maximizeButton).First.Value.Class = "CaptionButtonBorder"; this.systemButtons.Children.Add(maximizeButton); this.closeButton = new RadImageButtonElement(); this.closeButton.StateManager = new RibbonBarSystemButtonStateManager().StateManagerInstance; this.closeButton.ThemeRole = "RibbonCloseButton"; this.closeButton.Class = "CloseButton"; this.closeButton.Image = Properties.Resources.ribbon_close; this.closeButton.Click += new EventHandler(this.OnClose); selector.GetSelectedElements(this.closeButton).First.Value.Class = "CaptionButtonFill"; borderSelector.GetSelectedElements(this.closeButton).First.Value.Class = "CaptionButtonBorder"; this.systemButtons.Children.Add(closeButton); this.captionText = new TextPrimitive(); this.captionText.Class = "TitleCaption"; this.captionText.TextAlignment = ContentAlignment.MiddleCenter; captionText.SetValue(RibbonBarCaptionLayoutPanel.CaptionTextProperty, true); captionText.BindProperty(TextPrimitive.TextProperty, this, RadItem.TextProperty, PropertyBindingOptions.OneWay); this.captionText.FontChanged += new EventHandler(captionText_FontChanged); }
/// <summary>Create the elements in the hierarchy.</summary> protected override void CreateChildElements() { this.borderPrimitive = new BorderPrimitive(); borderPrimitive.Class = "RadPanelBorder"; this.fillPrimitive = new FillPrimitive(); fillPrimitive.BackColor = Color.Transparent; fillPrimitive.BackColor2 = Color.Transparent; fillPrimitive.BackColor3 = Color.Transparent; fillPrimitive.BackColor4 = Color.Transparent; fillPrimitive.Class = "RadPanelFill"; this.textPrimitive = new TextPrimitive(); this.textPrimitive.StretchHorizontally = true; this.textPrimitive.StretchVertically = true; this.textPrimitive.Alignment = ContentAlignment.MiddleLeft; textPrimitive.BindProperty(TextPrimitive.TextProperty, this, RadLabelElement.TextProperty, PropertyBindingOptions.TwoWay); this.Children.Add(this.fillPrimitive); this.Children.Add(this.borderPrimitive); this.Children.Add(this.textPrimitive); }
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); }