<Window x:Class="TwitterClient.PinDialogBox"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Podaj pin" Height="136" Width="300" Name="PinWindow">
    <Window.Resources>
        <Style x:Key="textBoxErrorStyle" TargetType="TextBox">
            <Style.Triggers>
                <Trigger Property="Validation.HasError" Value="true">
                    <Setter Property="ToolTip"
                            Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                        Path=(Validation.Errors)[0].ErrorContent}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid>
        <TextBox Height="44" Margin="12,12,12,0" Name="textBox" VerticalAlignment="Top" Opacity="0.4" FontSize="24" Style="{StaticResource textBoxErrorStyle }">
            <TextBox.Text >
                <Binding Path="Pin" ElementName="PinWindow"  ValidatesOnExceptions="True"
                 UpdateSourceTrigger="PropertyChanged">
                    <Binding.ValidationRules>
                        <DataErrorValidationRule/>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
        <Button Opacity="0.8" Content="OK" Height="23" Margin="0,0,93,12" Name="buttonOK" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" Click="ButtonOk_Click" IsEnabled="{Binding ElementName=PinWindow, Path=IsValid}" />
        <Button Opacity="0.8"  Content="Anuluj" Margin="0,0,12,12" Name="buttonCancel" Height="23" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" IsCancel="True"/>
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
                <GradientStop Color="#FFD9D9D9" Offset="0"/>
                <GradientStop Color="White" Offset="1"/>
            </LinearGradientBrush>
        </Grid.Background>
    </Grid>
</Window>
