I'm trying to bind a combobox to a list in my VM,
the combobox is located in a datagrid, this datagrid is binded to another datagrid.
How should I set up binding?
All binding that is set up now works just fine, exept for the binding on the combobox.
I can't seem to find my datacontext that is set in the mainwindow...
This is what i have so far (It does'nt work ofcourse..)
What i have now, in xaml:
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<Grid>
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding ListBarcode}">
<DataGrid.Columns >
<DataGridTextColumn Binding="{Binding Path=Name,Mode=TwoWay,
ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged,
ValidatesOnExceptions=True}" Header="BarcodeName" Width="Auto" />
<DataGridTextColumn Binding="{Binding Path=Number,Mode=TwoWay,
ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged,
ValidatesOnExceptions=True}" Header="BarcodeNumber" Width="Auto" />
<DataGridComboBoxColumn Header="Brand" Width="1*" MaxWidth="100"
ItemsSource="{Binding Path=DataContext.ListBrands,
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window},
AncestorLevel=1}}" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
Thanks in advance!
Answer:
WPF nested Datagrid in datagrid details {binding}[
^]