I have a page with a view model. I am trying set the binding source of a combo box from a templated DataGrid column to the view model. It gives me a null reference error.
This is my XAML:
<navigation:Page.Resources>
<vm:SiteViewModel x:Key="viewModel" />
</navigation:Page.Resources>
<navigation:Page.DataContext>
<Binding Source="{StaticResource viewModel}" />
</navigation:Page.DataContext>
...
<data:DataGrid ItemsSource="{Binding CurrentSite.Contacts}">
<data:DataGrid.Columns>
<data:DataGridTemplateColumn Header="Role">
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Path=Roles, Source=????}" >
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=RoleName}" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
</data:DataGrid.Columns>
</data:DataGrid>