Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1255
How do you bind combobox items in a datagrid to an earlier part of a heirarchy
posted

You have a good example of how to bind to a property inside of a combobox item and link a second combobox to the first combobox item when you posted the following

<Style TargetType="{x:Type igEditors:XamComboEditor}">
    <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type igDP:DataRecordPresenter}}, Path=DataRecord.DataItem.State.Cities}" />
    <Setter Property="DisplayMemberPath" Value="CityName" />
</Style>

This works well, the problem is that I have a very complex heirarchy and need to bind to a list farther up the heirarchy.  As an example, I will use the hypothetical data structure

PlanetList: Planet: Country: State: City

How would I change the ancestor type to reference in a list in the correct Planet record from the state combobox. I cant reference the Planet directly because it is part of a list and I need the planet being used to display the state combobox items.