Hi,
Will this control have a Text property that we could use to get the visible text? Using the combination of SearchText and SelectedItem, depending on if the user actually selected from the list, or entered a completly new value is not really "developer friendly".
update: of course, this can only work if the SelectionMode is set to Single. If it's multiselect, my question is not valid.
Thanks,
Gyula
Will this control have a Text property that we could use to get the visible text? Using the combination of SearchText and SelectedItem, depending on if the user actually selected from the list, or entered a completly new value is not really "developer friendly".
update: of course, this can only work if the SelectionMode is set to Single. If it's multiselect, my question is not valid.
Thanks,
Gyula
12 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 28 Mar 2013, 05:03 AM
Hi Gyula,
The RadAutoCompleteBox does not have a Text property. Since the AutoComplete entries are treated as Tokens, you can use the SelectedItem.ToString() to get the selected item text. The SearchText does not return the AutoCompleteBox items, instead it returns the plain text you are entering in the AutoCompleteBox to filter out items.
Thanks,
Princy.
The RadAutoCompleteBox does not have a Text property. Since the AutoComplete entries are treated as Tokens, you can use the SelectedItem.ToString() to get the selected item text. The SearchText does not return the AutoCompleteBox items, instead it returns the plain text you are entering in the AutoCompleteBox to filter out items.
Thanks,
Princy.
0
Gyula
Top achievements
Rank 1
answered on 28 Mar 2013, 07:17 AM
Hello Princy,
Yes, that is how it works. To retreive the displayed value, I have to check if it's a SelectedItem, and if it's not, then take the SearchText. What if the user enters a valid value, but not from the list. Like the google navigation bar in Google Chrome. It offers me a lot of possible solutions, but my final text may not be in their list.
This control works great if you want to enter "tags", but it's a bit complicated when it comes to the "google search textbox" solution. With a Text property, this could be a lot more easier. It could be read-only, and it's value wouldn't be very useful with multiselect. (comma or separeted values)
So, to post a question: how do you implement the google chrome navigation bar with this control?
Thanks,
Gyula
Yes, that is how it works. To retreive the displayed value, I have to check if it's a SelectedItem, and if it's not, then take the SearchText. What if the user enters a valid value, but not from the list. Like the google navigation bar in Google Chrome. It offers me a lot of possible solutions, but my final text may not be in their list.
This control works great if you want to enter "tags", but it's a bit complicated when it comes to the "google search textbox" solution. With a Text property, this could be a lot more easier. It could be read-only, and it's value wouldn't be very useful with multiselect. (comma or separeted values)
So, to post a question: how do you implement the google chrome navigation bar with this control?
Thanks,
Gyula
0
Hello,
In the current version of RadAutoCompleteBox there is a known issue that is causing the SearchText property of the control to not be updated when an item has been selected. When this issue is resolved the SearchText property will represent the selected item's text when a selection is made which should help the previously described limitations of the SearchText property.
The issue is logged in our Public Issue Tracker System where you can track its status.
All the best,
Vladi
the Telerik team
In the current version of RadAutoCompleteBox there is a known issue that is causing the SearchText property of the control to not be updated when an item has been selected. When this issue is resolved the SearchText property will represent the selected item's text when a selection is made which should help the previously described limitations of the SearchText property.
The issue is logged in our Public Issue Tracker System where you can track its status.
All the best,
Vladi
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Gyula
Top achievements
Rank 1
answered on 02 Apr 2013, 06:23 AM
Hello Vladi,
Thank you for your answer. Will this mean, that the SearchText property will always contain the visible text in the control?
Gyula
Thank you for your answer. Will this mean, that the SearchText property will always contain the visible text in the control?
Gyula
0
Hi,
When the issue is resolved the SearchText property will represent the typed in text when a selection is not made and the visible text when an item is selected. Meaning that if you highlight an item by navigating to it with the keyboard when the AutoCompleteMode is set to Append or SuggestAppend the appended text will not be represented in the SearchText property.
All the best,
Vladi
the Telerik team
When the issue is resolved the SearchText property will represent the typed in text when a selection is not made and the visible text when an item is selected. Meaning that if you highlight an item by navigating to it with the keyboard when the AutoCompleteMode is set to Append or SuggestAppend the appended text will not be represented in the SearchText property.
All the best,
Vladi
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Gyula
Top achievements
Rank 1
answered on 02 Apr 2013, 07:06 AM
Hello again,
I see.
I've put together a small project to show what I want to create, and why I would like to use a Text property.
UI:
CodeBehind:
In codebehind, I would like to use only 1 property. (And do databinding.) For example, a Text property, that gets the whole string visible in the control. And please note the SelectionMode="Single" setter in the XAML. (The Text property would have meaning only with this set.)
I hope this clears things.
Gyula
I see.
I've put together a small project to show what I want to create, and why I would like to use a Text property.
UI:
<
Window
x:Class
=
"RadAutoCompleteBoxTest.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
telerik:RadAutoCompleteBox
Grid.Row
=
"0"
Name
=
"radacb"
SelectionMode
=
"Single"
/>
<
telerik:RadButton
Grid.Row
=
"1"
Content
=
"Search the WEB"
Click
=
"RadButton_Click"
/>
</
Grid
>
</
Window
>
CodeBehind:
using
System;
using
System.Linq;
using
System.Windows;
using
System.Collections.Generic;
using
Telerik.Windows.Controls;
namespace
RadAutoCompleteBoxTest
{
public
partial
class
MainWindow : Window
{
List<
string
> suggestions =
new
List<
string
> {
"telerik"
,
"radautocompletebox"
,
"text property"
,
"google search box"
,
"behavior"
,
"behaviour"
,
"developer friendly controls"
,
"p0rn"
,
};
public
MainWindow()
{
InitializeComponent();
radacb.ItemsSource = suggestions;
}
private
void
RadButton_Click(
object
sender, RoutedEventArgs e)
{
string
searchString =
string
.Empty;
if
(radacb.SelectedItem !=
null
)
// does it have anything selected?
{
// get the selected value, since SearchText will NOT contain the whole string
searchString = radacb.SelectedItem.ToString();
}
else
{
// get the value from SearchText
searchString = radacb.SearchText;
}
if
(searchString.Length > 0)
{
// it's a new value, let's store it somehow
if
(!suggestions.Contains(searchString))
suggestions.Add(searchString);
RadWindow.Alert(searchString);
}
}
}
}
In codebehind, I would like to use only 1 property. (And do databinding.) For example, a Text property, that gets the whole string visible in the control. And please note the SelectionMode="Single" setter in the XAML. (The Text property would have meaning only with this set.)
I hope this clears things.
Gyula
0
Hi,
As mentioned before when the issue with the SearchText property is resolved the property should be useful in this scenario because it will represent the inputted text when a selection is not made and the displayed text when a selection is made. The only limitation would be when a selection is not made and an item is highlighted by navigation to it with the keyboard and the AutoCompleteMode is either Suggest or SuggestAppend. In that case the appended text from the highlighting will not be included in the SearchText property and it will still represent the inputted text.
Regards,
Vladi
the Telerik team
As mentioned before when the issue with the SearchText property is resolved the property should be useful in this scenario because it will represent the inputted text when a selection is not made and the displayed text when a selection is made. The only limitation would be when a selection is not made and an item is highlighted by navigation to it with the keyboard and the AutoCompleteMode is either Suggest or SuggestAppend. In that case the appended text from the highlighting will not be included in the SearchText property and it will still represent the inputted text.
Regards,
Vladi
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Gyula
Top achievements
Rank 1
answered on 05 Apr 2013, 09:30 AM
Hi,
That's closer. (Altough, if you resolve this "issue", we will loose the SearchText value after selection. It would look like, if the user searched for that particular value.)
I think my problem is, that RadAutoCompleteBox can do much more, that I actually need. I'm thinking with list of strings, and not with list of complex objects. From this perspective, a (Display)Text property can not be implemented. (Won't work with multiselect, won't work with complex objects, ect.)
I can create a "limited" version of your control, implementing a Text property. I just wanted to avoid this, because it would add one more layer of maintanence. But, after all, that's my job...
Thank you for your help,
Gyula
That's closer. (Altough, if you resolve this "issue", we will loose the SearchText value after selection. It would look like, if the user searched for that particular value.)
I think my problem is, that RadAutoCompleteBox can do much more, that I actually need. I'm thinking with list of strings, and not with list of complex objects. From this perspective, a (Display)Text property can not be implemented. (Won't work with multiselect, won't work with complex objects, ect.)
I can create a "limited" version of your control, implementing a Text property. I just wanted to avoid this, because it would add one more layer of maintanence. But, after all, that's my job...
Thank you for your help,
Gyula
0
Accepted
Hi,
We believe that the SearchText property by design should update its value to the full visible text when a selection is made and the current behavior of that property is not correct.
Unfortunately as you mentioned when the issue is resolved you will no longer be able to access the inputted text but we believe that, that text is of no importance after a selection is made and the full visible text is more important because we are not aware of any scenarios in which the inputted text would be of importance.
Could you describe to us in more details a scenario in which that text would be useful in order for us to go through the useful cases where it could be important and possibly implement such functionality in the future versions of the control.
Greetings,
Vladi
the Telerik team
We believe that the SearchText property by design should update its value to the full visible text when a selection is made and the current behavior of that property is not correct.
Unfortunately as you mentioned when the issue is resolved you will no longer be able to access the inputted text but we believe that, that text is of no importance after a selection is made and the full visible text is more important because we are not aware of any scenarios in which the inputted text would be of importance.
Could you describe to us in more details a scenario in which that text would be useful in order for us to go through the useful cases where it could be important and possibly implement such functionality in the future versions of the control.
Greetings,
Vladi
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Gyula
Top achievements
Rank 1
answered on 10 Apr 2013, 01:55 PM
Hi,
To be honest, probably I won't be needing the typed text at any given time.
But, just for the sake of argument, let's say I'm working for a company, named Giigle. We would like to implement a search engine, but with a black screen. Our biggest value would be the statistical data we collect from the users. We would like to know, that on avarage, how many characters had to be typed to present an usable value for the user. (This could help us improve our engine.)
Another use could be, to present advertisement to the users, because we know that when someone types "TELE", then in 95% of the cases, they choose "TELERIK". (So, they would see your ad, even when they just type "TELE".)
Of course, this is just in theory - as I mentioned, I'm OK, if you resolve the issue.
On the other hand, when the control autosuggests a value, but the user does not select anything from the list, the SearchText property will still be containing the typed text. Correct? Because it would be a real case scenario to be able to use the control to add new items to a list.
For example:
I have a list containing AAABBB and AAACCC. The user enters AAA, and hits ENTER. I want to add to my list this value (AAA), and not the autosuggested value (for example AAABBB). This way, when the user starts to type A, the list will contain AAA, AAABBB, AAACCC. (Let's call this "the learning list".)
Thanks,
Gyula
To be honest, probably I won't be needing the typed text at any given time.
But, just for the sake of argument, let's say I'm working for a company, named Giigle. We would like to implement a search engine, but with a black screen. Our biggest value would be the statistical data we collect from the users. We would like to know, that on avarage, how many characters had to be typed to present an usable value for the user. (This could help us improve our engine.)
Another use could be, to present advertisement to the users, because we know that when someone types "TELE", then in 95% of the cases, they choose "TELERIK". (So, they would see your ad, even when they just type "TELE".)
Of course, this is just in theory - as I mentioned, I'm OK, if you resolve the issue.
On the other hand, when the control autosuggests a value, but the user does not select anything from the list, the SearchText property will still be containing the typed text. Correct? Because it would be a real case scenario to be able to use the control to add new items to a list.
For example:
I have a list containing AAABBB and AAACCC. The user enters AAA, and hits ENTER. I want to add to my list this value (AAA), and not the autosuggested value (for example AAABBB). This way, when the user starts to type A, the list will contain AAA, AAABBB, AAACCC. (Let's call this "the learning list".)
Thanks,
Gyula
0
Hi,
Thank you for your feedback.
You are correct when an item is not selected the SearchText would remain the inputted text, only if a selection is made the SearchText will be updated.
Regards,
Vladi
the Telerik team
Thank you for your feedback.
You are correct when an item is not selected the SearchText would remain the inputted text, only if a selection is made the SearchText will be updated.
Regards,
Vladi
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Jeremy
Top achievements
Rank 1
answered on 09 Sep 2016, 05:28 PM
I had a similar problem accessing the displayed text in the box versus the typed text. I solved it by accessing the WatermarkBox in my event handler.
Based on what I was needing this works perfectly.
var box = (RadAutoCompleteBox)sender;
var textBox = box.ChildrenOfType<
RadWatermarkTextBox
>().First();
string displayedText = textBox.text;