Master ComboBox with Detail Grid

2 posts, 0 answers
  1. underwater
    underwater avatar
    4 posts
    Member since:
    Mar 2011

    Posted 12 Apr 2011 Link to this post

    I am just starting out, and trying to use data binding to display a parent child relationship.

    I need to first have the user select in a ComboBox my List of "Currency" objects and display in a Grid the related "CurrencyRates" collection of the selected currency object

    I can see the list of currencies in the combo when I bind the ItemsSource property to the DataContext
    <telerik:RadComboBox ItemsSource="{Binding}" DisplayMemberPath="Name" x:Name="cboCurrencyList"  />

    I am not sure how to get a Grid to show the child collection CurrencyRates.... I've tried the code below but didn't work
    Source="{Binding ElementName=cboCurrencyList, Path=SelectedValue}"/>

    I am using EF4

  2. Valeri Hristov
    Valeri Hristov avatar
    2252 posts

    Posted 15 Apr 2011 Link to this post


    Assuming that the RadComboBox ItemsSource is a collection of Currency objects, then with your configuration the value of the SelectedValue property will be of type Currency. If the Currency type has a property CurrencyRates, the Grid Source should be something like:
    Source="{Binding ElementName=cboCurrencyList, Path=SelectedValue.CurrencyRates}"

    Instead of SelectedValue you could use SelectedItem with the same result.

    Valeri Hristov
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top