view delete me/SilverlightValidation/Views/UserListView.xaml @ 59:3591c26bd63e

MVVMLight added
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sat, 21 Apr 2012 19:20:28 +0100
parents
children
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:p="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls"
             xmlns:s="clr-namespace:System;assembly=mscorlib"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
             d:DesignHeight="400"
             d:DesignWidth="725"
             mc:Ignorable="d">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="40" />
            <RowDefinition Height="300" />
            <RowDefinition Height="50" />
        </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 Width="60"
                    Command="{Binding AddCommand}"
                    Content="Add"
                    Style="{StaticResource ButtonStyle}" />
            <Button Width="60"
                    Command="{Binding CancelCommand}"
                    Content="Delete"
                    Style="{StaticResource ButtonStyle}" />
        </StackPanel>

        <controls:DataGrid Grid.Row="2"
                           Grid.Column="1"
                           AutoGenerateColumns="False"
                           ItemsSource="{Binding Data}"
                           SelectedItem="{Binding SelectedItem}">
            <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 XXXDescription,
                                                               Mode=TwoWay,
                                                               ValidatesOnNotifyDataErrors=True,
                                                               NotifyOnValidationError=True}"
                                             Header="Description" />
            </controls:DataGrid.Columns>
        </controls:DataGrid>
    </Grid>
</UserControl>