DataGrid内からウィンドウのDataContextにアクセスするのに問題があります。
DataGridはIBindingListにバインドされています。
public IBindingList Items{ get; set; }
private void initItems()
{
//ItemFactory is a Linq2SQL Context, Items is the view of availabe Items
this.Items = this.ItemFactory.Items.GetNewBindingList();
}
xaml内から、これらのデータを取得してComboBoxに入力しようとします。
<DataGridComboBoxColumn Header="Typ"
DisplayMemberPath="Description"
SelectedValuePath="ItemID"
ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}, Mode=OneWay, Path=DataContext.Items, UpdateSourceTrigger=PropertyChanged}" />
しかし、それは機能しません。私はすでに多くの変種を試しました。ComboBoxは設定されません。
どんな助けでも大歓迎です!
ノート:
同じウィンドウ内の次のComboBoxは機能します。
<ComboBox x:Name="workingCombo" ItemsSource="{Binding Path=Items}" DisplayMemberPath="Description" SelectedValuePath="ItemID" />