WPF Toolkit Calendar/DatePicker displaying public holidays: Converter not being called when appropriate (based on the "Red Letter Days" sample by Petzold)

Sep 29, 2009 at 4:48 PM
Edited Sep 29, 2009 at 7:27 PM

Hi folks,

I have custom style for the WPF Toolkit's Calendar control (actually I'm using it in the DatePicker control) which uses a Converter in order to display public holidays.
The scenario is following what Charles Petzold has introduced in this MSDN-magazine article in the "Red Letter Days"-example: http://msdn.microsoft.com/en-us/magazine/dd882520.aspx

Theres one significant difference though: in my template, I need to change the style of the tooltip that is being presented when the user hovers over a public holiday. That is, I have a custom style for all tooltips to be displayed in my app which is unsuitable for displaying (short) information about the holiday.
In the template that Charles introduces, the ToolTip is simply assigned to the Grid contained in each CalendarDayButton:

<Grid ToolTip="{Binding Converter={StaticResource conv}, Mode=OneWay}">
...
</Grid>

Since I can only assign a custom style to the ToolTip, I changed the above to:

<Grid>
<Grid.ToolTip>
<ToolTip Style="{StaticResource HolidayToolTipStyle}">
<TextBlock Padding="5" Text="{Binding Converter={StaticResource conv}, Mode=OneWay}"/>
</ToolTip>
</Grid.ToolTip>
...
</Grid>

This will successfully change the style of the ToolTip. However, this brings up a very strange problem: the calendar now doesn't seem to be calling into the converter when it would be appropriate in order to check for the tooltip-text. As a result, even though the background of public holidays is just fine, the ToolTip sometimes doesn't show at all (it does only after the corresponding day/date has been clicked), sometimes it shows for the wrong day (i.e. when moving between months, the ToolTip is displayed for the calendar-cell which contained a holiday-date in the previously selected month).

Has anybody encountered this before and found a work-around, or am I missing something fundamental here?

Cheers,
Olaf

(X-Post from http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/400e846a-d63d-4c8e-83f0-4f7a7580fea5 - the CodePlex forum might be better suited though, therefore the XPost.)

Sep 30, 2009 at 4:01 PM

Hi folks,

the issue has been resolved. See the original thread here: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/400e846a-d63d-4c8e-83f0-4f7a7580fea5

Cheers,
Olaf