RadTextBoxControl : Watermark enabled autocomplete

4 posts, 0 answers
  1. Chan
    Chan avatar
    14 posts
    Member since:
    Nov 2012

    Posted 01 Apr 2013 Link to this post

    Helo !

    I used RadTextBoxControl in winforms.(win7, .net4.0)
    I used this control to search records (Text box to search records with autocomplete feature).

    Now, i want my autocomplete to be similar as of google search box works.
    like, the moment i started typing text in the textboxcontrol the first matching record should appear as watermark, instead of highlighted and selected.This autocomplete records being pulled from database.

    While typing the text in radtextboxcontrol, the matching characters should be highlighted with bold fonts and the rest characters from matching records should be watermarked. Contents being displayed in dropdown should be inversely formatted with respect to contents in textbox(e.g. matching characters should be watermarked and rest should be bold)

    For illustration of my problem you may have look on google searchtextbox.

    Looking ahead for your response.

    Thanks,
    Arpus

  2. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 04 Apr 2013 Link to this post

    Hello Arpus,

    Thank you for writing.

    Currently, RadTextBoxControl does not support such a functionality. If more people request the same, we will consider adding such a request and implementing it in future.

    Thank you for this suggestion.
     

    Regards,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Chan
    Chan avatar
    14 posts
    Member since:
    Nov 2012

    Posted 02 May 2013 Link to this post


    Helo Stefan !

    I wrote few lines of code to acheive my aim depending on the selection change of text in textBox while typing with autocomplete :




    //Text Change Event on RadTextBox
     private void radTxtSearch_TextChanged(object sender, EventArgs e)
            {     
                radTxtSearch.AutoCompleteDataSource = System.TimeZoneInfo.GetSystemTimeZones();
                radTxtSearch.AutoCompleteDisplayMember = System.TimeZoneInfo.Utc.DisplayName;
                radTxtSearch.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                radTxtSearch.MaxDropDownItemCount = 10;
     
                radTxtSearch_WaterMark();// calling native method          
             }
     
            private void radTxtSearch_WaterMark()
            {
                radTxtSearch.TextBoxElement.ForeColor = Color.Black;
                radTxtSearch.TextBoxElement.Font = new Font(radTxtSearch.Font, FontStyle.Bold);
                radTxtSearch.TextBoxElement.SelectionColor = Color.Cornsilk;
     
                for (int i = 0; i < radTxtSearch.AutoCompleteItems.Count; i++)
                {
                    radTxtSearch.AutoCompleteItems[i].Font = new Font(radTxtSearch.Font, FontStyle.Bold);
                }
     
                DDSearch.ForeColor = Color.Black; // DDSearch is System.Windows.Forms.ComboBox
                DDSearch.Font = new Font(radTxtSearch.Font, FontStyle.Bold);// set the font of RadTextbox to combobox.
             }
  5. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 07 May 2013 Link to this post

    Hello Chan,

    Thank you for sharing your code with us. I am sure the community will benefit from it.

    If you wish, you can create a C# and VB sample projects demonstrating this functionality in action and submit them in our Code Library section, so the community can easily find them. This will get you some 
    Telerik Points.

    All the best,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top