Auto Selection like Winforms Combobox

3 posts, 0 answers
  1. Gary
    Gary avatar
    4 posts
    Member since:
    Jan 2013

    Posted 22 Jul 2015 Link to this post

    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. Gary
    Gary avatar
    4 posts
    Member since:
    Jan 2013

    Posted 22 Jul 2015 in reply to Gary Link to this post

    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"/>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 23 Jul 2015 Link to this post

    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
Back to Top