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

RadTextBoxControl : Watermark enabled autocomplete

3 Answers 198 Views
TextBoxControl
This is a migrated thread and some comments may be shown as answers.
Chan
Top achievements
Rank 1
Chan asked on 02 Apr 2013, 04:21 AM

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

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 04 Apr 2013, 03:15 PM
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.
0
Chan
Top achievements
Rank 1
answered on 02 May 2013, 11:30 AM

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.
         }
0
Stefan
Telerik team
answered on 07 May 2013, 05:34 AM
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.
Tags
TextBoxControl
Asked by
Chan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Chan
Top achievements
Rank 1
Share this question
or