I'm trying to populate the dropdown list within the Grid column but it's empty. The Grid column is defined like this:
<DataGridTemplateColumn Header="Voucher Type" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding VoucherType}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox SelectedItem="{Binding VoucherType}" ItemsSource="{Binding Path=DataContext.VTypes, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
The context class has the source defined like this:
public static ObservableCollection<string> VType { get; } = new ObservableCollection<string>()
{
"Journal Voucher",
"Cash Received Voucher",
"Cash Payment Voucher",
"Bank Received Voucher",
"Bank Payment Voucher",
};
Can someone please point to what I'm doing wrong?
Thanks.