Set SelectedItem in RadAutoCompleteBox

2 posts, 0 answers
  1. Adam
    Adam avatar
    4 posts
    Member since:
    Dec 2012

    Posted 05 Feb 2013 Link to this post

    Hi,
    I need use RadAutoCompleteBox instead DataFormComboBoxField which works perfectly.
    Problem is when I start editing. In ComboBox selectedItem is showing but in AutoCompleteBox is blank space.
    works:

    <telerik:DataFormComboBoxField 
                                    ItemsSource="{Binding DataView, ElementName=UmowyDataSource}"
                                    DataMemberBinding="{Binding UmowaId,Mode=TwoWay}"    
                                    DisplayMemberPath="NumerUmowy" 
                                    SelectedValuePath="Identyfikator"
                                    Label="Umowa"    
                                    />

    not works corectly:

    <telerik:RadAutoCompleteBox ItemsSource="{Binding DataView, ElementName=UmowyDataSource}"
                                                                DisplayMemberPath="NumerUmowy"
                                                                SelectionMode="Single"
                                                                Name="Umowa"                                                           
                                                                SelectedItem="{Binding Path=UmowaId,Mode=TwoWay,Converter={StaticResource ProjektyStatusConverter}}"
                                                                TextSearchMode="Contains"
                                                                TextSearchPath="NumerUmowy"
                                                                />

    Also
    Convert:

    public class ProjektyStatusConverter : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                if (value != null)
                {
                    return value;
                }
                else
                {
                    return value;
                }
            }
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
     
                if (value != null)
                {
                    UmowyItem umowa = value as UmowyItem;
                    Int32 umowaID = umowa.Identyfikator;
                    return umowaID;
                }
                else
                {
                    return value;
                }
            }
        }

    I need implementing RadAutoCompleteBox with binding. When i start editing in  RadAutoCompleteBox must be correct item

  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 08 Feb 2013 Link to this post

    Hi Adam,

    Thank you for contacting us.

    We tried to reproduce the issue with the code snippets you sent to us but to no avail.

    I created and attached a sample project for you that shows how to use RadAutoCompleteBox in RadDataForm, give it a try.

    If you have any other questions feel free to write to us again.

    Regards,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top