I have an radautocompletebox with a list of forms, I want to be able to search on the form number or name, but for space purposes only display the form number once a form is selected.
I have a list of form objects with these properties:
Value = "001"
Display = "Identification Card"
ValueDisplay = "001-Identification Card"
The autocomplete box:
TextSearchPath = "Value"
DisplayPath = "ValueDisplay"
This shows the ValueDisplay in the dropdown and selects Value when selected but it does not allow for searching on the form name (Display).
Is there a way to allow searching on ValueDisplay but only show Value when selected?
4 Answers, 1 is accepted
You will need to set TextSearchPath to "ValueDisplay" as this is the property set for searching and DisplayPath to "Value" as this sets what's displayed when an item is selected.
Additionally, if you'd like to search on two properties at the same time, you will need to implement custom FilteringBehavior as explained in the Filtering Behavior topic inside our documentation. You could also take a look at the TwoPropertiesFilteringBehavior SDK example in our XAML Repository.
Regards,
Yana
Telerik
At first I had it set up exactly how you said, with TextSearchPath="ValueDisplay" and DisplayPath="Value".
I have 2 examples with screen shots; example 1 has tsp=value and dp=valuedisplay, example 2 has them switched, see the results:
Example 1:
<
telerik:RadAutoCompleteBox
DisplayMemberPath
=
"ValueDisplay"
TextSearchPath
=
"Value"
AutoCompleteMode
=
"SuggestAppend"
TextSearchMode
=
"Contains"
SelectionMode
=
"Single"
WatermarkContent
=
"Enter Form Number(s)..."
/>
Example 2:
<
telerik:RadAutoCompleteBox
DisplayMemberPath
=
"Value"
TextSearchPath
=
"ValueDisplay"
AutoCompleteMode
=
"SuggestAppend"
TextSearchMode
=
"Contains"
SelectionMode
=
"Single"
WatermarkContent
=
"Enter Form Number(s)..."
/>
Additionally, when I SelectionMode to Multiple it gets odd, see example 3 code and screen shot:
Example 3:
<
telerik:RadAutoCompleteBox
DisplayMemberPath
=
"Value"
TextSearchPath
=
"ValueDisplay"
AutoCompleteMode
=
"SuggestAppend"
TextSearchMode
=
"Contains"
SelectionMode
=
"Multiple"
WatermarkContent
=
"Enter Form Number(s)..."
/>
RESOLVED
I was able to get the desired results by setting the TestSearchPath to Value, omitting DisplayMemberPath and instead using a DropDownItemTemplate to disply a custom list and a also adding a custom FilteringBehaviour to search two fields.
I still believe that the default behaviour isincorrect but with the ability to have a custom dropdowntemplate and custom filtering its a moot point.
Thanks