How do I bind to an object?

2 posts, 0 answers
  1. Martin
    Martin avatar
    39 posts
    Member since:
    Sep 2008

    Posted 11 Mar 2013 Link to this post

    My objects has a RequiredCondition property.

    RequiredCondition has Id, Name and so one.

    I also has an Collection that is the ItemsSource.

    How do I set up the binding? 

     <telerik:RadComboBox ItemsSource="{Binding Path=DataContext.Conditions, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type views:PropertyEditorView}}}"
                                                         SelectedItem="{Binding RequiredCondition}"
                                                         SelectedValue="{Binding RequiredCondition}"
                                                         DisplayMemberPath="Name" EmptyText="Select an Expression" />

     
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 13 Mar 2013 Link to this post

    Hi Martin,

    You could check the following help article which explains how to bind RadComboBox to a collection of custom objects:
    http://www.telerik.com/help/wpf/radcombobox-populating-with-data-binding-to-object.html

    Note that in this case the SelectedItem is of the type of the custom object and it should be set to one of the objects in the collection bound to the ItemsSource.   More information about selection of the ComboBox can be found here.

    Greetings,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top