Possible Duplicate:
Wpf Toolkit. Bind DataGrid Column Header to DynamicResource
WPF Error: Cannot find govering FrameworkElement for target element
I am creating a WPF application using the MVVM pattern, so on my view I am trying to bind the column header of a DataGrid
column to a property on my view model which is the data context of the view that the DataGrid
is in.
XAML:
<DataGrid Name="DailyData" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Path=DailyDataViewModels}" HorizontalAlignment="Stretch">
<DataGrid.Columns>
<DataGridTextColumn Header="{Binding InflowVolumeLabel}" Binding="{Binding InflowVolume}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
However the header just shows up blank and does not seem to be trying to bind to the specified property, how can you bind a DataGrid
column header?