Hi,
I need to extend the Resource class with some new properties that I need to display in the ResourceGroupHeader.
We use resources for employees in a scheduling tool.
We need to display how many minutes every employee is scheduled for and how many minutes he/she is allowed to work.
So I created a class called TimeScheduleEmployeeResource that looks like this:
And my group header template looks like this:
But it will only display the employee name and the / no information from the two extended properties PlannedMinutes and WorkingHoursMinutes. My MinutesToTimeSpan converter is never called either.
I was puzzled by one thing. The first TextBlock is bound to the 'Name' property, but where is that defined?
The Resource class has a DisplayName property.
Am I overriding the wrong class here?
Regards,
Håkan
I need to extend the Resource class with some new properties that I need to display in the ResourceGroupHeader.
We use resources for employees in a scheduling tool.
We need to display how many minutes every employee is scheduled for and how many minutes he/she is allowed to work.
So I created a class called TimeScheduleEmployeeResource that looks like this:
public
class
TimeScheduleEmployeeResource : Resource
{
#region Extended properties
private
int
plannedMinutes;
public
int
PlannedMinutes
{
get
{
return
plannedMinutes; }
set
{ plannedMinutes = value; }
}
private
int
workingHoursMinutes;
public
int
WorkingHoursMinutes
{
get
{
return
workingHoursMinutes; }
set
{ workingHoursMinutes = value; }
}
#endregion
}
And my group header template looks like this:
<
local:CustomOrientedGroupHeaderContentTemplateSelector.VerticalResourceTemplate
>
<
DataTemplate
>
<
StackPanel
Orientation
=
"Vertical"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
Width
=
"150"
>
<
StackPanel.Resources
>
<
Style
TargetType
=
"TextBlock"
BasedOn
=
"{StaticResource DefaultTextBlock}"
>
<
Setter
Property
=
"VerticalAlignment"
Value
=
"Center"
/>
<
Setter
Property
=
"TextWrapping"
Value
=
"Wrap"
/>
</
Style
>
</
StackPanel.Resources
>
<
TextBlock
Text
=
"{Binding Name}"
Padding
=
"5,3,5,0"
/>
<
StackPanel
Orientation
=
"Horizontal"
HorizontalAlignment
=
"Stretch"
Margin
=
"5,0,5,3"
>
<
TextBlock
Text
=
"{Binding PlannedMinutes, Converter={StaticResource MinutesToTimeSpanConverter}}"
/>
<
TextBlock
Text
=
"/"
/>
<
TextBlock
Text
=
"{Binding WorkingHoursMinutes, Converter={StaticResource MinutesToTimeSpanConverter}}"
/>
</
StackPanel
>
</
StackPanel
>
</
DataTemplate
>
</
local:CustomOrientedGroupHeaderContentTemplateSelector.VerticalResourceTemplate
>
But it will only display the employee name and the / no information from the two extended properties PlannedMinutes and WorkingHoursMinutes. My MinutesToTimeSpan converter is never called either.
I was puzzled by one thing. The first TextBlock is bound to the 'Name' property, but where is that defined?
The Resource class has a DisplayName property.
Am I overriding the wrong class here?
Regards,
Håkan