I am trying to build a booking screen where the columns will be Monday through Sunday. There may be multiple rows but i don't think that is important. I want to add seven user controls and bind each one to a different day of the week.
I have a datagrid with a usercontrol in it and it is working. To get it working I had to bind the usercontrol to a specific property on the datarow (Mon). I want to be able to tell the usercontrol what property to bind to through xaml
The user control datagrid looks like this.
<DataGrid
IsReadOnly="False"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
SelectionMode="Extended"
ItemsSource="{Binding Mon.BookingWeekBookingList, Mode=OneWay}"
SelectionUnit="FullRow"
EnableColumnVirtualization="True"
EnableRowVirtualization="True" >
<DataGrid.Columns>
<DataGridTextColumn Header="Contract" Width="50*" IsReadOnly="True" Binding="{Binding Path=ContractId}" />
<DataGridTextColumn Header="Tonnes" Width="50*" IsReadOnly="True" Binding="{Binding Path=Tonnes}" />
</DataGrid.Columns>
</DataGrid>
On the main window I add the userControll to the datagrid like this
<DataGridTemplateColumn Header="Monday" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<local:BookingWeekIntervalView DataContext="{Binding}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
How Can I change it so I Specify the day of week in the main window binding? Rather than the itemsSource on the user control.