Adding a text box to splt button drop down

3 posts, 0 answers
  1. Peter
    Peter avatar
    6 posts
    Member since:
    Nov 2006

    Posted 30 Jan 2007 Link to this post

    Is it possible to display a text box in the drop down of a split button. I assume it is possible from the example of adding a custom element to the RadMenu. However, it is not clear how to.

    My attempt at doing this
                RadMenuContentItem contentTextBox = new RadMenuContentItem();  
     
                RadTextBoxElement RadtextBoxNoteElement = new RadTextBoxElement();  
     
                RadtextBoxNoteElement.Size = new Size(139, 15);  
     
                contentTextBox.ContentElement = RadtextBoxNoteElement;  
                  
     
                this.radSplitButton1.Items.Add(contentTextBox); 

    I am using Q4 2006 SP1 version.

    Thanks
    Peter

  2. Peter
    Peter avatar
    6 posts
    Member since:
    Nov 2006

    Posted 30 Jan 2007 Link to this post

    I have been able to display the textbox however i cannot type in the textbox. I changed from splitbutton to dropdownbutton.

    Current code is

    RadTextBoxItem NoteTextBoxitem = new RadTextBoxItem();

    NoteTextBoxitem.Name = "NoteTextBox";

    radDropDownButton1.Items.Add(NoteTextBoxitem);

    Do I have to create an instance of RadTextBoxElement? I tried but could not see how to associate NoteTextBoxitem with RadTextBoxElement.

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Georgi
    Admin
    Georgi avatar
    212 posts

    Posted 31 Jan 2007 Link to this post

    Hi Peter,

    The right approach to add a textbox in the split button item is as follows:

    private void Form1_Load(object sender, EventArgs e)  
            {             
                RadMenuContentItem item1 = new RadMenuContentItem();      
                RadTextBoxElement text1 = new RadTextBoxElement();  
                text1.Text = "text1";  
                text1.MaxSize = new Size(50, 0); //here is set the desired width for the textbox
                item1.ContentElement = text1;  
                item1.ContentElement.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;  
                radSplitButton1.Items.Add(item1);  
     
                RadMenuContentItem item2 = new RadMenuContentItem();  
                RadTextBoxElement text2 = new RadTextBoxElement();  
                text2.Text = "text2";  
                text2.MaxSize = new Size(50, 0);  
                item2.ContentElement = text2;  
                item2.ContentElement.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;  
                radSplitButton1.Items.Add(item2);  
     
            } 
     
    Unfortunately, there is a problem related to the focus behavior of the textbox when it is nested in other controls. Currently we're working on that issue and it will be finalized for the Q4 SP2 release. We're sorry for the inconvenience.
     

    Sincerely yours,
    Georgi
    the telerik team
Back to Top