view SilverlightExampleApp/SilverlightExampleApp/Views/ClientSearch.xaml @ 67:b0e369f1e948

Updated name for window title
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sun, 22 Apr 2012 16:01:14 +0100
parents 502f5f365649
children
line wrap: on
line source

<navigation:Page x:Class="SilverlightExampleApp.Views.ClientSearch"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                 xmlns:local="clr-namespace:SilverlightExampleApp.Converters"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                 xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                 Title="ClientSearch Page"
                 d:DesignHeight="480"
                 d:DesignWidth="800"
                 DataContext="{Binding ClientSearchViewModel,
                                       Source={StaticResource Locator}}"
                 mc:Ignorable="d">
    <Grid x:Name="LayoutRoot">

        <Grid.Resources>
            <local:DateTimeConverter x:Key="DateTimeConverter" />
        </Grid.Resources>

        <Grid.RowDefinitions>
            <RowDefinition Height="10" />
            <RowDefinition Height="25" />
            <RowDefinition Height="10" />
            <RowDefinition Height="*" />
            <RowDefinition Height="25" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="800" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <StackPanel Grid.Row="1"
                    Grid.Column="1"
                    Orientation="Horizontal">
            <TextBlock Text="Criteria:" />
            <TextBox Width="400" Margin="20,0,20,0" />
            <Button Width="40"
                    Command="{Binding SearchCommand}"
                    Content="Go" />
        </StackPanel>

        <StackPanel Grid.Row="1"
                    Grid.RowSpan="2"
                    Grid.Column="1"
                    Margin="5"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Bottom"
                    Orientation="Horizontal">
            <Button Width="60"
                    Height="20"
                    Command="{Binding AddCommand}"
                    Content="Add" />
            <Button Width="60"
                    Height="20"
                    Command="{Binding EditCommand,
                                      Mode=TwoWay}"
                    Content="Edit" />
            <Button Width="60"
                    Height="20"
                    Command="{Binding DeleteCommand,
                                      Mode=TwoWay}"
                    Content="Remove" />
        </StackPanel>

        <sdk:DataGrid Name="dgClients"
                      Grid.Row="3"
                      Grid.Column="1"
                      AutoGenerateColumns="False"
                      IsReadOnly="True"
                      ItemsSource="{Binding Clients}"
                      SelectedItem="{Binding SelectedClient,
                                             Mode=TwoWay}"
                      SelectionMode="Single">

            <i:Interaction.Triggers>
                <i:EventTrigger EventName="KeyUp">
                    <cmd:EventToCommand Command="{Binding DeleteKeyCommand}" PassEventArgsToCommand="True" />
                </i:EventTrigger>
            </i:Interaction.Triggers>

            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn Width="50"
                                        Binding="{Binding Path=Id}"
                                        CanUserReorder="True"
                                        CanUserResize="True"
                                        CanUserSort="True"
                                        Header="Id" />
                <sdk:DataGridTextColumn Width="80"
                                        Binding="{Binding Path=Title.Description}"
                                        CanUserReorder="True"
                                        CanUserResize="True"
                                        CanUserSort="True"
                                        Header="Title" />
                <sdk:DataGridTextColumn Width="120"
                                        Binding="{Binding Path=FirstName}"
                                        CanUserReorder="True"
                                        CanUserResize="True"
                                        CanUserSort="True"
                                        Header="First Name" />
                <sdk:DataGridTextColumn Width="120"
                                        Binding="{Binding Path=FamilyName}"
                                        CanUserReorder="True"
                                        CanUserResize="True"
                                        CanUserSort="True"
                                        Header="Family Name" />
                <sdk:DataGridTextColumn Width="200"
                                        Binding="{Binding Path=Residence.Description}"
                                        CanUserReorder="True"
                                        CanUserResize="True"
                                        CanUserSort="True"
                                        Header="Residence" />
                <sdk:DataGridTextColumn Binding="{Binding Path=DateOfBirth, Converter={StaticResource DateTimeConverter}, ConverterParameter=dd MMM yy}" Header="Date of Birth" />
                <sdk:DataGridCheckBoxColumn Width="70"
                                            Binding="{Binding Path=ActiveFlag}"
                                            CanUserReorder="True"
                                            CanUserResize="True"
                                            CanUserSort="True"
                                            Header="Active" />
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
    </Grid>
</navigation:Page>