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

Auto Selection like Winforms Combobox

2 Answers 95 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 22 Jul 2015, 04:53 PM

Hi,
I have a combobox that has the ItemsSource bound to an observablecollection of Priority objects. Priority objects have and ID and a Description.
My combobox is in a DataTemplate for a listBoxItem that is bound to another collection of objects. Filter objects, which have a FilterPriorityID property
I set the combobox.DisplayMemberPath="Description" which seems fine.
I set the SelectedValuePath="{Binding FilterPriorityID}" expecting the combobox to auto select the correct Priority using the FilterPriorityID. but this is not the case.
Seems i am missing something, coming from Winforms.
Gary

<telerik:RadComboBox ItemsSource="{Binding Path=DataContext.EventFilterPriorites, RelativeSource={RelativeSource AncestorType=UserControl}}"
                                     SelectedValuePath="{Binding Path=EventFilterPriorityID}"
                                     DisplayMemberPath="Description"
                                     VerticalAlignment="Top"
                                     HorizontalAlignment="Left"
                                     Height="25"
                                     Margin="3"
                                     Width="100"/>

2 Answers, 1 is accepted

Sort by
0
Gary
Top achievements
Rank 1
answered on 22 Jul 2015, 06:08 PM

Well now i feel stupid. this works.

<telerik:RadComboBox ItemsSource="{Binding Path=DataContext.EventFilterPriorites, RelativeSource={RelativeSource AncestorType=UserControl}}"
                                    SelectedValuePath="EventFilterPriorityID"
                                    SelectedValue="{Binding EventFilterPriorityID}"
                                    DisplayMemberPath="Description"
                                    VerticalAlignment="Top"
                                    HorizontalAlignment="Left"
                                    Height="25"
                                    Margin="3"
                                    Width="100"/>

0
Kalin
Telerik team
answered on 23 Jul 2015, 07:01 AM
Hello Gary,

I'm glad you have managed to achieve the desired. If you have any other questions or concerns, please let us know.

Regards,
Kalin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ComboBox
Asked by
Gary
Top achievements
Rank 1
Answers by
Gary
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or