<Window x:Class="BindingGroupValidation_Sample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:BindingGroupValidation_Sample"
        mc:Ignorable="d"
       Title="BindingGroupValidation_Sample" Height="150" Width="250"
        Name="frmMain">
    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="Black" Offset="0"/>
            <GradientStop Color="White" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>
    <Window.BindingGroup>
        <BindingGroup>
            <BindingGroup.ValidationRules>
                <local:PersonValidationRule />
            </BindingGroup.ValidationRules>
        </BindingGroup>
    </Window.BindingGroup>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBox Text="{Binding Vorname}" Margin="5"/>
        <TextBox Text="{Binding Zuname}" Grid.Row="1" Margin="5 0 5 5"/>
        <StackPanel Grid.Row="2" Orientation="Horizontal">
            <Button Name="btnSave" Click="btnSave_Click" Margin="5" Width="80">Speichern</Button>
            <Button Name="btnCancel" Grid.Row="3" Click="btnCancel_Click" Margin="5" Width="80">Abbrechen</Button>
        </StackPanel>
        <Label Name="lblErrors" Content="{Binding ElementName=frmMain,Path=(Validation.Errors)[0].ErrorContent}" Foreground="Red" Grid.Row="3"  />
    </Grid>
</Window>

