Completed
Last Updated: 28 Jun 2017 10:26 by ADMIN
ADMIN
Hristo
Created on: 16 Jun 2017 14:05
Category:
Type: Bug Report
0
FIX. RadTrackBar - exception when setting the Text property of the TrackBarLabelElement in the designer
How to reproduce: 
partial class Form2
    {
        /// <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.radTrackBar1 = new Telerik.WinControls.UI.RadTrackBar();
            ((System.ComponentModel.ISupportInitialize)(this.radTrackBar1)).BeginInit();
            this.SuspendLayout();
            // 
            // radTrackBar1
            // 
            this.radTrackBar1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.radTrackBar1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(233)))), ((int)(((byte)(240)))), ((int)(((byte)(249)))));
            this.radTrackBar1.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.radTrackBar1.LabelStyle = Telerik.WinControls.UI.TrackBarLabelStyle.BottomRight;
            this.radTrackBar1.LargeChange = 5;
            this.radTrackBar1.LargeTickFrequency = 139;
            this.radTrackBar1.Location = new System.Drawing.Point(36, 69);
            this.radTrackBar1.Maximum = 140F;
            this.radTrackBar1.Minimum = 1F;
            this.radTrackBar1.Name = "rTrackBar1";
            this.radTrackBar1.Size = new System.Drawing.Size(243, 33);
            this.radTrackBar1.SmallTickFrequency = 5;
            this.radTrackBar1.SnapMode = Telerik.WinControls.UI.TrackBarSnapModes.None;
            this.radTrackBar1.TabIndex = 0;
            this.radTrackBar1.Text = "rTrackBar1";
            this.radTrackBar1.ThemeName = "ControlDefault";
            this.radTrackBar1.TickStyle = Telerik.WinControls.Enumerations.TickStyles.None;
            this.radTrackBar1.Value = 80F;
            ((Telerik.WinControls.UI.RadTrackBarElement)(this.radTrackBar1.GetChildAt(0))).MinSize = new System.Drawing.Size(100, 0);
            ((Telerik.WinControls.UI.TrackBarBodyElement)(this.radTrackBar1.GetChildAt(0).GetChildAt(1))).Margin = new System.Windows.Forms.Padding(7, 0, 7, 0);
            ((Telerik.WinControls.UI.TrackBarScaleContainerElement)(this.radTrackBar1.GetChildAt(0).GetChildAt(1).GetChildAt(0))).Orientation = System.Windows.Forms.Orientation.Vertical;
            ((Telerik.WinControls.UI.TrackBarScaleElement)(this.radTrackBar1.GetChildAt(0).GetChildAt(1).GetChildAt(0).GetChildAt(2))).Orientation = System.Windows.Forms.Orientation.Vertical;
            ((Telerik.WinControls.UI.TrackBarScaleElement)(this.radTrackBar1.GetChildAt(0).GetChildAt(1).GetChildAt(0).GetChildAt(2))).StretchVertically = false;
            ((Telerik.WinControls.UI.TrackBarLabelContainerElement)(this.radTrackBar1.GetChildAt(0).GetChildAt(1).GetChildAt(0).GetChildAt(2).GetChildAt(1))).StretchVertically = false;
            ((Telerik.WinControls.UI.TrackBarLabelElement)(this.radTrackBar1.GetChildAt(0).GetChildAt(1).GetChildAt(0).GetChildAt(2).GetChildAt(1).GetChildAt(0))).Text = "Lo";
            ((Telerik.WinControls.UI.TrackBarLabelElement)(this.radTrackBar1.GetChildAt(0).GetChildAt(1).GetChildAt(0).GetChildAt(2).GetChildAt(1).GetChildAt(1))).Text = "Hi";
            // 
            // Form2
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(822, 515);
            this.Controls.Add(this.radTrackBar1);
            this.Name = "Form2";
            this.Text = "Form2";
            ((System.ComponentModel.ISupportInitialize)(this.radTrackBar1)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private Telerik.WinControls.UI.RadTrackBar radTrackBar1;
    }

Workaround: remove setting of the text from the designer file to the Shown event of the form
public partial class Form2 : Form
{
    public Form2()
    {
        InitializeComponent();
    }

    protected override void OnShown(EventArgs e)
    {
        base.OnShown(e);

        ((Telerik.WinControls.UI.TrackBarLabelElement)(this.radTrackBar1.GetChildAt(0).GetChildAt(1).GetChildAt(0).GetChildAt(2).GetChildAt(1).GetChildAt(0))).Text = "Lo";
        ((Telerik.WinControls.UI.TrackBarLabelElement)(this.radTrackBar1.GetChildAt(0).GetChildAt(1).GetChildAt(0).GetChildAt(2).GetChildAt(1).GetChildAt(1))).Text = "Hi";
    }
}
0 comments