This is a migrated thread and some comments may be shown as answers.

Dragging out and reinserting ToolStripItem Issue

1 Answer 92 Views
Toolstrip (obsolete as of Q3 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
nieve
Top achievements
Rank 1
nieve asked on 03 Dec 2007, 08:51 AM
Hello all,
This is an issue I came across while using the RadToolStrip:
I set a new RadToolStrip back colour to ControlDark, set the ToolStripItem Back Colour to transparent and the ToggleButtonElement to transparent/white gradient (see code below).
Whenever I drag the ToolStripItem outside it's ToolStripElement, let it float, then take it back and dock it in the ToolStripElement again, the Item looses the colours I gave it and is repainted in gradient blue as well as getting a bigger size.
Is it a bug, or something can be done here?

namespace RadToolStripTest 
    partial class Form1 
    { 
        /// <summary> 
        /// Required designer variable. 
        /// </summary> 
        private System.ComponentModel.IContainer components = null
 
        /// <summary> 
        /// Clean up any resources being used. 
        /// </summary> 
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 
        protected override void Dispose(bool disposing) 
        { 
            if (disposing && (components != null)) 
            { 
                components.Dispose(); 
            } 
            base.Dispose(disposing); 
        } 

        #region Windows Form Designer generated code 
 
        /// <summary> 
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor. 
        /// </summary> 
        private void InitializeComponent() 
        { 
            this.radToolStrip1 = new Telerik.WinControls.UI.RadToolStrip(); 
            this.radToolStripElement1 = new Telerik.WinControls.UI.RadToolStripElement(); 
            this.radToolStripItem1 = new Telerik.WinControls.UI.RadToolStripItem(); 
            this.radToggleButtonElement1 = new Telerik.WinControls.UI.RadToggleButtonElement(); 
            ((System.ComponentModel.ISupportInitialize)(this.radToolStrip1)).BeginInit(); 
            this.SuspendLayout(); 
            //  
            // radToolStrip1 
            //  
            this.radToolStrip1.AllowDragging = true
            this.radToolStrip1.AllowFloating = true
            this.radToolStrip1.Dock = System.Windows.Forms.DockStyle.Left; 
            this.radToolStrip1.Items.AddRange(new Telerik.WinControls.RadItem[] { 
            this.radToolStripElement1}); 
            this.radToolStrip1.Location = new System.Drawing.Point(0, 0); 
            this.radToolStrip1.MinimumSize = new System.Drawing.Size(5, 5); 
            this.radToolStrip1.Name = "radToolStrip1"
            this.radToolStrip1.Orientation = System.Windows.Forms.Orientation.Vertical; 
            //  
            //  
            //  
            this.radToolStrip1.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren; 
            this.radToolStrip1.RootElement.MinSize = new System.Drawing.Size(5, 5); 
            this.radToolStrip1.RootElement.StretchHorizontally = false
            this.radToolStrip1.RootElement.StretchVertically = true
            this.radToolStrip1.ShowOverFlowButton = true
            this.radToolStrip1.Size = new System.Drawing.Size(75, 430); 
            this.radToolStrip1.TabIndex = 0; 
            this.radToolStrip1.Text = "radToolStrip1"
            ((Telerik.WinControls.Primitives.FillPrimitive)(this.radToolStrip1.GetChildAt(0).GetChildAt(0))).BackColor = System.Drawing.SystemColors.ControlDark; 
            ((Telerik.WinControls.Primitives.FillPrimitive)(this.radToolStrip1.GetChildAt(0).GetChildAt(0))).BackColor2 = System.Drawing.SystemColors.ControlDark; 
            //  
            // radToolStripElement1 
            //  
            this.radToolStripElement1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(192))))); 
            this.radToolStripElement1.BorderThickness = new System.Windows.Forms.Padding(1); 
            this.radToolStripElement1.Items.AddRange(new Telerik.WinControls.RadItem[] { 
            this.radToolStripItem1}); 
            this.radToolStripElement1.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0); 
            this.radToolStripElement1.MinSize = new System.Drawing.Size(21, 0); 
            this.radToolStripElement1.Text = "radToolStripElement1"
            //  
            // radToolStripItem1 
            //  
            this.radToolStripItem1.BorderThickness = new System.Windows.Forms.Padding(1); 
            this.radToolStripItem1.Class = "ToolStripItem"
            this.radToolStripItem1.Items.AddRange(new Telerik.WinControls.RadItem[] { 
            this.radToggleButtonElement1}); 
            this.radToolStripItem1.Key = "0"
            this.radToolStripItem1.MinSize = new System.Drawing.Size(25, 21); 
            this.radToolStripItem1.Orientation = System.Windows.Forms.Orientation.Vertical; 
            this.radToolStripItem1.Text = "radToolStripItem1"
            ((Telerik.WinControls.Primitives.FillPrimitive)(this.radToolStripItem1.GetChildAt(1))).BackColor4 = System.Drawing.Color.Transparent; 
            ((Telerik.WinControls.Primitives.FillPrimitive)(this.radToolStripItem1.GetChildAt(1))).BackColor3 = System.Drawing.Color.Transparent; 
            ((Telerik.WinControls.Primitives.FillPrimitive)(this.radToolStripItem1.GetChildAt(1))).BackColor = System.Drawing.Color.Transparent; 
            ((Telerik.WinControls.Primitives.FillPrimitive)(this.radToolStripItem1.GetChildAt(1))).BackColor2 = System.Drawing.Color.Transparent; 
            ((Telerik.WinControls.UI.RadToolStripOverFlowButtonElement)(this.radToolStripItem1.GetChildAt(4))).AngleTransform = 90F; 
            ((Telerik.WinControls.UI.RadToolStripOverFlowButtonElement)(this.radToolStripItem1.GetChildAt(4))).Visibility = Telerik.WinControls.ElementVisibility.Hidden; 
            //  
            // radToggleButtonElement1 
            //  
            this.radToggleButtonElement1.AngleTransform = 90F; 
            this.radToggleButtonElement1.AutoSize = false
            this.radToggleButtonElement1.BorderThickness = new System.Windows.Forms.Padding(1); 
            this.radToggleButtonElement1.Bounds = new System.Drawing.Rectangle(0, 0, 50, 50); 
            this.radToggleButtonElement1.CanFocus = true
            this.radToggleButtonElement1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 
            this.radToggleButtonElement1.IsChecked = false
            this.radToggleButtonElement1.Text = "Test 01"
            this.radToggleButtonElement1.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off; 
            ((Telerik.WinControls.Primitives.FillPrimitive)(this.radToggleButtonElement1.GetChildAt(0))).BackColor4 = System.Drawing.Color.White; 
            ((Telerik.WinControls.Primitives.FillPrimitive)(this.radToggleButtonElement1.GetChildAt(0))).BackColor3 = System.Drawing.Color.Transparent; 
            ((Telerik.WinControls.Primitives.FillPrimitive)(this.radToggleButtonElement1.GetChildAt(0))).BackColor = System.Drawing.Color.Transparent; 
            ((Telerik.WinControls.Primitives.FillPrimitive)(this.radToggleButtonElement1.GetChildAt(0))).BackColor2 = System.Drawing.Color.Transparent; 
            //  
            // Form1 
            //  
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 
            this.ClientSize = new System.Drawing.Size(601, 430); 
            this.Controls.Add(this.radToolStrip1); 
            this.Name = "Form1"
            this.Text = "Form1"
            ((System.ComponentModel.ISupportInitialize)(this.radToolStrip1)).EndInit(); 
            this.ResumeLayout(false); 
            this.PerformLayout(); 
 
        } 

        #endregion 
 
        private Telerik.WinControls.UI.RadToolStrip radToolStrip1; 
        private Telerik.WinControls.UI.RadToolStripElement radToolStripElement1; 
        private Telerik.WinControls.UI.RadToolStripItem radToolStripItem1; 
        private Telerik.WinControls.UI.RadToggleButtonElement radToggleButtonElement1; 
    } 
 
 

1 Answer, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 03 Dec 2007, 01:45 PM
Hello nieve,

When you drag a toolStripItem outside the bounds of its toolStripElement the built-in logic creates a new floating form which is a container for the items possessed by RadToolStripItem, and the current RadToolStripItem instance is disposed. When you drop the floating form over an instance of RadToolStripElement a new instance of RadToolStripItem is created with the items from the floating form, so the color properties which you have set in design time are lost.

To fix the problem, modifythe theme of RadToolStrip through the VisualStyleBuilder and then apply it to RadToolStrip.

Contact me if you have more questions.
 

Best wishes,
Boyko Markov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Toolstrip (obsolete as of Q3 2010)
Asked by
nieve
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Share this question
or