Hello,
I have a Grid that displays a start and end time for each day of the week. The column headers must include the Date and DayOfWeek formatted basically like this: ...ToString("ddd M/d")
I'm not sure how I go about setting the Binding property. Here's what I have just using hard coded values but really, I need these to be bound to the view model (and not StaticResource either because if the user chooses a different week, then those values must update).
See the pattern? How do I go about making the date part of the Text in the TextBlock bound to something? I was thinking I'd just have a property hanging off the ViewModel - one for each day and each Start/End column called MondayStartHeader, MondayEndHeader, etc. That won't work though because the grid is bound to a collection of objects on the ViewModel.
Thanks.
I have a Grid that displays a start and end time for each day of the week. The column headers must include the Date and DayOfWeek formatted basically like this: ...ToString("ddd M/d")
I'm not sure how I go about setting the Binding property. Here's what I have just using hard coded values but really, I need these to be bound to the view model (and not StaticResource either because if the user chooses a different week, then those values must update).
<telerik:RadGridView Grid.Row="1" Margin="10" Name="radGridViewScheduleLines" ItemsSource="{Binding ScheduleLines}" AutoGenerateColumns="False" IsFilteringAllowed="False" ShowGroupPanel="False"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn DataMemberBinding="{Binding TeamMemberName}" Header="Team Member" CellStyle="{StaticResource TeamMemberColumnStyle}" IsSortable="False" /> |
<telerik:GridViewDataColumn DataMemberBinding="{Binding JobCode}" Header="Code" IsSortable="False" /> |
<telerik:GridViewComboBoxColumn DataMemberBinding="{Binding SundayStartDaySegment, Mode=TwoWay}" IsSortable="False" ItemsSource="{Binding DaySegments}" DisplayMemberPath="DisplayStart" Width="50"> |
<telerik:GridViewComboBoxColumn.Header> |
<StackPanel> |
<TextBlock Text="Sun 2/28 Start" |
TextWrapping="Wrap"/> |
</StackPanel> |
</telerik:GridViewComboBoxColumn.Header> |
</telerik:GridViewComboBoxColumn> |
<telerik:GridViewComboBoxColumn DataMemberBinding="{Binding SundayEndDaySegment, Mode=TwoWay}" IsSortable="False" ItemsSource="{Binding DaySegments}" DisplayMemberPath="DisplayEnd" Width="50"> |
<telerik:GridViewComboBoxColumn.Header> |
<StackPanel> |
<TextBlock Text="Sun 2/28 End" |
TextWrapping="Wrap"/> |
</StackPanel> |
</telerik:GridViewComboBoxColumn.Header> |
</telerik:GridViewComboBoxColumn> |
<telerik:GridViewComboBoxColumn DataMemberBinding="{Binding MondayStartDaySegment, Mode=TwoWay}" IsSortable="False" ItemsSource="{Binding DaySegments}" DisplayMemberPath="DisplayStart" Width="50"> |
<telerik:GridViewComboBoxColumn.Header> |
<StackPanel> |
<TextBlock Text="Mon 3/1 Start" |
TextWrapping="Wrap"/> |
</StackPanel> |
</telerik:GridViewComboBoxColumn.Header> |
</telerik:GridViewComboBoxColumn> |
</telerik:RadGridView.Columns> |
</telerik:RadGridView> |
See the pattern? How do I go about making the date part of the Text in the TextBlock bound to something? I was thinking I'd just have a property hanging off the ViewModel - one for each day and each Start/End column called MondayStartHeader, MondayEndHeader, etc. That won't work though because the grid is bound to a collection of objects on the ViewModel.
Thanks.