I have a custom control that overrides Window:
public class Window : System.Windows.Window
{
static Window()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(Window), new System.Windows.FrameworkPropertyMetadata(typeof(Window)));
}
...
}
It also has a style:
<Style TargetType="{x:Type Controls:Window}" BasedOn="{StaticResource {x:Type Window}}">
<Setter Property="WindowStyle"
Value="None" />
<Setter Property="Padding"
Value="5" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:Window}">
...
Unfortunately, this breaks the propagation of the Validation.ErrorEvent for my window's contents. That is, my window can receive the event just fine, but I don't know what to do with it to mimic how a standard Window (or whoever) deals with it.
If the validating controls are placed in a standard window, they work. They also work if I just take out the OverrideMetadata call (leaving them inside my custom window). They also work if I leave the OverrideMetadata call, but don't define a custom ControlTemplate. If I leave the template as the default one, the stuff inside properly receive their validation events and use their validation templates.
Why is this happening, and how can I get the stock functionality for handling these validation error events working again, using a custom control template?
Thanks!