DateTimePicker Validation Error Block Calendar Button

I had a lot of user complaints about the tooltip for the DateTime Picker for Silverlight showing the error tooltip over the Calendar button. It made it so that it was next to impossible to actually select a date, since you couldn’t click the button.

I opened the DateTimePicker template and voila! The tard who made such a nice control set the error template to sit next to the TextBox instead of the Button.

Simple fix. Just generate the  DateTimePicker template (Expression Blend) and change the following section:
i.e. Search for ToolTipService.ToolTip

<ToolTipService.ToolTip>
<ToolTip x:Name="validationTooltip" Template="{StaticResource CommonValidationToolTipTemplate}" Placement="Right" PlacementTarget="{Binding ElementName=Button}" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
<ToolTip.Triggers>
<EventTrigger RoutedEvent="Canvas.Loaded">
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<System:Boolean>true</System:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ToolTip.Triggers>
</ToolTip>
</ToolTipService.ToolTip>

Using Change the above to Button instead of TextBox. Super easy!

Happy Coding!

Leave a Reply

Your email address will not be published. Required fields are marked *