Hi,
I am having a weird behavior of the RadAutoCompleteBox. I have written my own behavior to populate all Items if searchtext is empty:
/// <summary>
/// Behavior um Rechte abzufragen
/// /// </summary>
public
class
AutoCompleteBehavior : FilteringBehavior
{
public
override
IEnumerable<
object
> FindMatchingItems(
string
searchText, System.Collections.IList items, IEnumerable<
object
> escapedItems,
string
textSearchPath, TextSearchMode textSearchMode)
{
IEnumerable<
object
> matches =
base
.FindMatchingItems(searchText, items, escapedItems, textSearchPath, textSearchMode);
if
(matches.Count() == 0 &&
string
.IsNullOrEmpty(searchText))
{
return
items
as
IEnumerable<
object
>;
}
return
matches;
}
}
The DropDownBox only shows after typing a Letter an deleting it again. Here is how i configured the RadAutoCompleteBox:
<
telerik:RadAutoCompleteBox
FilteringBehavior
=
"{StaticResource AutoCompleteBehavior}"
x:Name
=
"txt_targetHpsl"
Grid.Column
=
"0"
Grid.Row
=
"0"
Grid.ColumnSpan
=
"2"
TextSearchMode
=
"StartsWith"
ItemsSource
=
"{Binding ContextSelektionsErgebnisse}"
SearchText
=
"{Binding CurrentSelectionWfStep.TargetHpslDescription, Mode=TwoWay, Converter={StaticResource NullStringConverter}}"
AutoCompleteMode
=
"Suggest"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Center"
SelectionMode
=
"Single"
MinWidth
=
"120"
Foreground
=
"#396C9C"
/>
The NullStringConveter just returns string.Empty if value == null, because it causes an Exception to Bind SearchText to a Property containing null.
If I dont use a Custom FilteringBehavior, it works without typing and deleting a letter.
Is something wrong with my behavior?
Best Regards
Matthias