Hi
I have created a validation error template for a datepicker. It works but when I put the datepicker with the error template inside a usercontrol the validation doesn't trigger. Can someone help?
Here's my usercontrol xaml:
<UserControl x:Class="SandBox.LabelDatePicker" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="LDP"><Grid HorizontalAlignment="{Binding}"><Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions><TextBlock x:Name="tbl" Text="{Binding ElementName=LDP, Path=LabelText}" Width="{Binding ElementName=LDP, Path=LabelWidth}" VerticalAlignment="Center"/><DatePicker x:Name="dp" Grid.Column="1" SelectedDate="{Binding ElementName=LDP, Path=SelectedDate, Mode=TwoWay}" VerticalAlignment="Center"><Validation.ErrorTemplate><ControlTemplate><DockPanel LastChildFill="True" ToolTip="{Binding ElementName=aep, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"><TextBlock DockPanel.Dock="Right" Foreground="Red" FontSize="14pt" Text="*" Margin="5,0,0,0" VerticalAlignment="Center" FontWeight="Bold"/><Border BorderBrush="Red" BorderThickness="1"><AdornedElementPlaceholder Name="aep"/></Border></DockPanel></ControlTemplate></Validation.ErrorTemplate></DatePicker></Grid></UserControl>