view SilverlightGlimpse/SilverlightValidation/Views/UserListView.xaml @ 72:177a9d1eba10

Latest version
author Steven Hollidge <stevenhollidge@hotmail.com>
date Mon, 23 Apr 2012 17:57:21 +0100
parents 96e6fbd70f49
children 86ed4919b126
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="500"
             d:DesignWidth="725"
             mc:Ignorable="d">

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

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

        <controls:DataGrid x:Name="dataGridUsers"
                           Grid.Row="2"
                           Grid.Column="1"
                           AutoGenerateColumns="False"
                           ItemsSource="{Binding Data}"
                           SelectedItem="{Binding SelectedItem,
                                                  Mode=TwoWay}"
                           SelectionMode="Single">
            <controls:DataGrid.Columns>
                <controls:DataGridTextColumn x:Name="dgtcUsername"
                                             Width="125"
                                             Binding="{Binding Username,
                                                               Mode=TwoWay,
                                                               ValidatesOnNotifyDataErrors=True,
                                                               NotifyOnValidationError=True}"
                                             Header="Username" />
                <controls:DataGridTemplateColumn x:Name="dgtcPassword"
                                                 Width="125"
                                                 Header="Password">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <PasswordBox x:Name="pbPassword" Password="{Binding Password, Mode=TwoWay, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </controls:DataGridTemplateColumn>
                <controls:DataGridTextColumn x:Name="dgtcEmail"
                                             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 x:Name="dpDateOfBirth"
                                            KeyDown="DatePicker_KeyDown"
                                            SelectedDate="{Binding DateOfBirth,
                                                                   Mode=TwoWay,
                                                                   ValidatesOnNotifyDataErrors=True,
                                                                   NotifyOnValidationError=True}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </controls:DataGridTemplateColumn>
                <controls:DataGridTextColumn x:Name="dgtcDescription"
                                             Width="150"
                                             Binding="{Binding INCORRECTPATH,
                                                               Mode=TwoWay,
                                                               ValidatesOnNotifyDataErrors=True,
                                                               NotifyOnValidationError=True}"
                                             Header="Description" />
            </controls:DataGrid.Columns>
        </controls:DataGrid>

        <Button x:Name="btnThrowException"
                Grid.Row="4"
                Grid.Column="1"
                Width="150"
                Height="50"
                HorizontalAlignment="Center"
                Content="Throw Exception"
                Click="btnThrowException_Click"/>
    </Grid>
</UserControl>