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

suggestandappend

2 Answers 49 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
David Ocasio asked on 05 Nov 2012, 12:22 PM

Im not sure if im doing something wrong but
i have searchtext bound to my data class

<telerik:RadAutoCompleteBox Grid.Column="1" Margin="2" HorizontalAlignment="Stretch" TabIndex="1" SelectionMode="Single"
          DisplayMemberPath="Z_No" x:Name="ddZ_No" BorderThickness="1" IsTabStop="False" TextSearchMode="StartsWith"  AutoCompleteMode="SuggestAppend"
          Loaded="ddZ_No_Loaded" SelectionChanged="ddZ_No_SelectionChanged" >
</telerik:RadAutoCompleteBox>
Dim binding As New System.Windows.Data.Binding("Master")
binding.Source = ExternalAddStock
binding.Mode = Windows.Data.BindingMode.TwoWay
ddZ_No.SetBinding(RadAutoCompleteBox.SearchTextProperty, binding)

when a selection is made the textsearch property is not updated
i fixed that by forcing it in selectionchanged event

Private Sub ddZ_No_SelectionChanged(sender As System.Object, e As Telerik.Windows.Controls.SelectionChangedEventArgs)
    If ddZ_No.SelectedItem Is Nothing Then
        ddZ_No.SearchText = ""
    Else
        ddZ_No.SearchText = CType(ddZ_No.SelectedItem, Stock.ItemMaster).Z_No
    End If
End Sub

when the drop down is browsed the text is appended to the textbox
but it does not update the searchtext property
so if you click out of the box without hitting return the display shows a value that is not loaded in searchtext
and consequently does not update my bound object

see snapshots

is there a better way to do it

thanks
dco

2 Answers, 1 is accepted

Sort by
0
Accepted
Ivo
Telerik team
answered on 08 Nov 2012, 09:56 AM
Hi David,

The SearchText property represents the text that is used to filter the items into the RadAutoCompleteBox. Selecting an item should not update the SearchText and this is actually by design.
I would suggest you to use the SelectedItem property of the RadAutoCompleteBox. However have in mind that clicking outside of the control will not select an item and should delete the appended text. Currently the appended text is not deleted, but we will do our best to fix this for one of the upcoming releases.

Greetings,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 08 Nov 2012, 12:43 PM
thanks ivo
Tags
AutoCompleteBox
Asked by
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
Answers by
Ivo
Telerik team
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
Share this question
or