view SilverlightGlimpse/SilverlightValidation/Views/UserListView.xaml @ 71:96e6fbd70f49

Latest version
author Steven Hollidge <stevenhollidge@hotmail.com>
date Mon, 23 Apr 2012 14:54:24 +0100
parents a0bcd783e612
children 177a9d1eba10
line wrap: on
line source

<UserControl x:Class="SilverlightValidation.Views.UserListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
             d:DesignHeight="400"
             d:DesignWidth="725"
             mc:Ignorable="d">

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="40" />
            <RowDefinition Height="300" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="725" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <StackPanel Grid.Row="1"
                    Grid.Column="1"
                    HorizontalAlignment="Right"
                    Orientation="Horizontal">
            <Button Width="60"
                    Command="{Binding AddCommand}"
                    Content="Add"
                    Style="{StaticResource ButtonStyle}" />
            <Button Width="60"
                    Command="{Binding DeleteCommand}"
                    Content="Delete"
                    Style="{StaticResource ButtonStyle}" />
        </StackPanel>

        <controls:DataGrid Grid.Row="2"
                           Grid.Column="1"
                           AutoGenerateColumns="False"
                           ItemsSource="{Binding Data}"
                           SelectedItem="{Binding SelectedItem,
                                                  Mode=TwoWay}"
                           SelectionMode="Single">
            <controls:DataGrid.Columns>
                <controls:DataGridTextColumn Width="125"
                                             Binding="{Binding Username,
                                                               Mode=TwoWay,
                                                               ValidatesOnNotifyDataErrors=True,
                                                               NotifyOnValidationError=True}"
                                             Header="Username" />
                <controls:DataGridTemplateColumn Width="125" Header="Password">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <PasswordBox Password="{Binding Password, Mode=TwoWay, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </controls:DataGridTemplateColumn>
                <controls:DataGridTextColumn Width="150"
                                             Binding="{Binding Email,
                                                               Mode=TwoWay,
                                                               ValidatesOnNotifyDataErrors=True,
                                                               NotifyOnValidationError=True}"
                                             Header="Email" />

                <controls:DataGridTemplateColumn Width="150" Header="Date of Birth">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <sdk:DatePicker KeyDown="DatePicker_KeyDown" SelectedDate="{Binding DateOfBirth, Mode=TwoWay, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </controls:DataGridTemplateColumn>
                <controls:DataGridTextColumn Width="150"
                                             Binding="{Binding INCORRECTPATH,
                                                               Mode=TwoWay,
                                                               ValidatesOnNotifyDataErrors=True,
                                                               NotifyOnValidationError=True}"
                                             Header="Description" />
            </controls:DataGrid.Columns>
        </controls:DataGrid>
    </Grid>
</UserControl>