suggestandappend

3 posts, 1 answers
  1. David Ocasio
    David Ocasio avatar
    147 posts
    Member since:
    Nov 2009

    Posted 05 Nov 2012 Link to this post

    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. Answer
    Ivo
    Admin
    Ivo avatar
    390 posts

    Posted 08 Nov 2012 Link to this post

    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.

  3. DevCraft banner
  4. David Ocasio
    David Ocasio avatar
    147 posts
    Member since:
    Nov 2009

    Posted 08 Nov 2012 Link to this post

    thanks ivo
Back to Top