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

Set SelectedItem in RadAutoCompleteBox

1 Answer 265 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 05 Feb 2013, 01:35 PM

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

1 Answer, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 08 Feb 2013, 09:07 AM
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.

Tags
AutoCompleteBox
Asked by
Adam
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Share this question
or