view SilverlightGlimpse/SilverlightValidation/Views/UserView.xaml @ 77:86ed4919b126

Working version!
author Steven Hollidge <stevenhollidge@hotmail.com>
date Mon, 23 Apr 2012 22:06:05 +0100
parents a0bcd783e612
children dd6bcd2535b6
line wrap: on
line source

<c:ChildWindow x:Class="SilverlightValidation.Views.UserView"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
               xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
               Title="Add User"
               Width="500"
               Height="400">

    <Grid x:Name="LayoutRoot" Background="White">

        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="50" />
            <RowDefinition Height="120" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="30" />
            <ColumnDefinition Width="100" />
            <ColumnDefinition Width="300" />
            <ColumnDefinition Width="30" />
            <ColumnDefinition Width="30" />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="1"
                   Grid.Column="1"
                   Style="{StaticResource LabelStyle}"
                   Text="Username:" />

        <TextBox x:Name="tbUsername"
                 Grid.Row="1"
                 Grid.Column="2"
                 Style="{StaticResource TextBoxStyle}"
                 Text="{Binding Username,
                                Mode=TwoWay,
                                ValidatesOnNotifyDataErrors=True,
                                NotifyOnValidationError=True}" />

        <sdk:DescriptionViewer Grid.Row="1"
                               Grid.Column="3"
                               Width="20"
                               Description="Required"
                               Target="{Binding ElementName=tbUsername}" />

        <TextBlock Grid.Row="2"
                   Grid.Column="1"
                   Style="{StaticResource LabelStyle}"
                   Text="Password:" />

        <PasswordBox x:Name="tbPassword"
                     Grid.Row="2"
                     Grid.Column="2"
                     Password="{Binding Password,
                                        Mode=TwoWay,
                                        ValidatesOnNotifyDataErrors=True,
                                        NotifyOnValidationError=True}"
                     Style="{StaticResource PasswordBoxStyle}" />

        <sdk:DescriptionViewer Grid.Row="2"
                               Grid.Column="3"
                               Width="20"
                               Description="Required"
                               Target="{Binding ElementName=tbPassword}" />

        <TextBlock Grid.Row="3"
                   Grid.Column="1"
                   Style="{StaticResource LabelStyle}"
                   Text="Email:" />

        <TextBox x:Name="tbEmail"
                 Grid.Row="3"
                 Grid.Column="2"
                 Style="{StaticResource TextBoxStyle}"
                 Text="{Binding Email,
                                Mode=TwoWay,
                                ValidatesOnNotifyDataErrors=True,
                                NotifyOnValidationError=True}" />

        <sdk:DescriptionViewer Grid.Row="3"
                               Grid.Column="3"
                               Width="20"
                               Description="Required"
                               Target="{Binding ElementName=tbEmail}" />

        <TextBlock Grid.Row="4"
                   Grid.Column="1"
                   Style="{StaticResource LabelStyle}"
                   Text="Date of Birth:" />

        <sdk:DatePicker x:Name="dpDateOfBirth"
                        Grid.Row="4"
                        Grid.Column="2"
                        KeyDown="DatePicker_KeyDown"
                        SelectedDate="{Binding DateOfBirth,
                                               Mode=TwoWay,
                                               ValidatesOnNotifyDataErrors=True,
                                               NotifyOnValidationError=True}"
                        Style="{StaticResource DatePickerStyle}" />
        <sdk:DescriptionViewer Grid.Row="4"
                               Grid.Column="3"
                               Width="20"
                               Description="Required"
                               Target="{Binding ElementName=dpDateOfBirth}" />

        <TextBlock x:Name="tbDescription"
                   Grid.Row="5"
                   Grid.Column="1"
                   Style="{StaticResource LabelStyle}"
                   Text="Description:" />

        <TextBox Grid.Row="5"
                 Grid.Column="2"
                 Style="{StaticResource TextBoxStyle}"
                 Text="{Binding DONEITGAIN}" />
        <StackPanel Grid.Row="6"
                    Grid.Column="2"
                    HorizontalAlignment="Right"
                    Orientation="Horizontal">
            <Button x:Name="btnThrowException"
                    Width="120"
                    Margin="0,0,50,0"
                    Click="btnThrowException_OnClick"
                    Content="Throw Exception"
                    Style="{StaticResource ButtonStyle}" />
            <Button Command="{Binding OkCommand}"
                    Content="OK"
                    Style="{StaticResource ButtonStyle}" />
            <Button Command="{Binding CancelCommand}"
                    Content="Cancel"
                    Style="{StaticResource ButtonStyle}" />
        </StackPanel>

        <sdk:ValidationSummary Grid.Row="7"
                               Grid.Column="1"
                               Grid.ColumnSpan="2"
                               Style="{StaticResource ValidationSummaryStyle}" />

    </Grid>
</c:ChildWindow>