<Window x:Class="R12_Walidacja.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:R12_Walidacja"
        mc:Ignorable="d"
        Title="Walidacja danych (wersja 3)" Height="100" Width="400" Language="pl-PL">
    <Window.DataContext>
        <local:Towar Nazwa="ołówek" Cena="21"/>
    </Window.DataContext>
    <WrapPanel>
        <!--WrapPanel.Resources>
            <Style TargetType="TextBox">
                <Style.Triggers>
                    <Trigger Property="Validation.HasError" Value="true">
                        <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors).CurrentItem.ErrorContent}" />
                    </Trigger>
                </Style.Triggers>
            </Style>
        </WrapPanel.Resources-->
        <Label Content="Nazwa:"/>
        <TextBox Margin="5" Text="{Binding Nazwa}" Width="100"/>
        <Label Content="Cena:"/>
        <!--TextBox Margin="5" Text="{Binding Cena, UpdateSourceTrigger=PropertyChanged, StringFormat={}{0:F2}}" Width="100"/-->
        <TextBox Text="{Binding Cena, UpdateSourceTrigger=PropertyChanged, StringFormat={}{0:F2}}" Margin="5" Width="100">
            <Validation.ErrorTemplate>
                <ControlTemplate>
                    <StackPanel>
                        <!--Border BorderBrush="Red" BorderThickness="1" Width="100">
                            <AdornedElementPlaceholder/>
                        </Border-->
                        <AdornedElementPlaceholder/>
                        <TextBlock Text="{Binding CurrentItem.ErrorContent}" Foreground="Red"/>
                    </StackPanel>
                </ControlTemplate>
            </Validation.ErrorTemplate>
        </TextBox>
    </WrapPanel>
</Window>
