Inheriting RadTextbox with Multiline problems

2 posts, 0 answers
  1. Jorge Delgado-Lopez
    Jorge Delgado-Lopez avatar
    82 posts
    Member since:
    Aug 2007

    Posted 30 Jan 2009 Link to this post


    I am upgrading from an old solution, see, since this version is missing some functionality which I now need.

    My class inherits from RadTextBox where I override CreateChildItems and create my own.

    I follow the logic from your source and it all works perfectly. Except the multiline property, how can I implement it?

    I use the following controls.
            private readonly RadTextBoxItem textBox = new RadTextBoxItem();
            private readonly TextPrimitive title = new TextPrimitive();
            private readonly TextPrimitive validation = new TextPrimitive();

    A cut down version of CreateChildItems

                BoxLayout layoutTexts = new BoxLayout();
                layoutTexts.Orientation = Orientation.Horizontal;
                layoutTexts.StretchVertically = false;  // when true the control is drawn differently


                BoxLayout layout = new BoxLayout();
                layout.Orientation = Orientation.Vertical;





                Size = new Size(425, 34); // default size

    - jorge
  2. Peter
    Peter avatar
    1148 posts

    Posted 02 Feb 2009 Link to this post

    Hi Jorge Delgado-Lopez,

    Thank for writing.

    You should set the Control's AutoSize property to false
      public LabelMultilineTextBox() 
           this.AutoSize = false

    Also, override InitializeRootElement and set the RootElement's Stretch Property to True
     protected override void InitializeRootElement(RootRadElement rootElement) 
           rootElement.StretchVertically = true;            

    Please refer the attached project.

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top