Hi,
OK So I have a combo box which selects an administrator from a list of administrators:
<ComboBox x:Name="adminCombo"
ItemsSource="{Binding AdminsList}"
DisplayMemberPath="Name"
SelectedValue="{Binding Administrator}"
SelectedValuePath="Name"/>
and below this I have a WPF Toolkit DataGrid. Each administrator holds a list of user-defined fields (AvailableUDFs). In the first column of my datagrid I want to have an editable template consisting of another combobox whose items source is the list of fields belonging to the selected administrator. The following markup does not work.
<toolkit:DataGrid
AutoGenerateColumns="False"
ItemsSource="{Binding Path=UserDefinedFields}">
<toolkit:DataGrid.Columns>
<toolkit:DataGridTemplateColumn Header="Custom Data">
<toolkit:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding ElementName=adminCombo,
Path=SelectedValue.AvailableUDFs}"
SelectedValue="{Binding Field.Type}"
DisplayMemberPath="Name"/>
</DataTemplate>
</toolkit:DataGridTemplateColumn.CellEditingTemplate>
</toolkit:DataGridTemplateColumn>
</toolkit:DataGrid.Columns>
</toolkit:DataGrid>
I have also tried Relative Source - Find Ancestor and searching up the tree to the previous combo box, but to no avail. Oddly enough, putting the same combo box into a ListView's items template works fine, the correct list of items shows up dependent on the selected administrator. The problem with using a WPF ListView is that ultimately I want to have other editable cells on the same row, and a plain ListView is not intended for this purpose.
Can anyone help me out? Thanks Chris