<UserControl x:Class="DataViewDashboard.Views.PropertyGridView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:c="clr-namespace:DataViewDashboard.Converters"
             xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"
             xmlns:vm="clr-namespace:DataViewDashboard.ViewModels"
             mc:Ignorable="d">
    <UserControl.Resources>
        <c:ZeroIndexConverter x:Key="zeroIndexConverter" />
        <!--<Style TargetType="c1:C1PropertyGrid">
            <Setter Property="AutoGenerateProperties" Value="False" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Width" Value="500" />
         </Style>-->
        <DataTemplate DataType="{x:Type vm:CustomersViewModel}">
            <Grid>
                <Grid.Resources>
                    <Style TargetType="TextBlock">
                        <Setter Property="Margin" Value="10" />
                    </Style>
                </Grid.Resources>
                <c1:C1PropertyGrid x:Name="c1PropertyGrid1" SelectedObject="{Binding SelectedItem}"
                                   AutoGenerateProperties="False"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   Width="500">
                    <c1:C1PropertyGrid.PropertyAttributes>
                        <c1:PropertyAttribute MemberName="Title" DisplayName="Title" Category="Personal Info" />
                        <c1:PropertyAttribute MemberName="FirstName" DisplayName="First Name" Category="Personal Info" />
                        <c1:PropertyAttribute MemberName="MiddleName" DisplayName="Middle Name" Category="Personal Info" />
                        <c1:PropertyAttribute MemberName="LastName" DisplayName="Last Name" Category="Personal Info" />
                        <c1:PropertyAttribute MemberName="Suffix" DisplayName="Suffix" Category="Personal Info" />
                        <c1:PropertyAttribute MemberName="CompanyName" DisplayName="Company Name" Category="Contact Info" />
                        <c1:PropertyAttribute MemberName="SalesPerson" DisplayName="Sales Person" Category="Contact Info" />
                        <c1:PropertyAttribute MemberName="EmailAddress" DisplayName="Email Address" Category="Contact Info" />
                        <c1:PropertyAttribute MemberName="Phone" DisplayName="Phone" Category="Contact Info" />
                        <c1:PropertyAttribute MemberName="CustomerID" DisplayName="ID" Category="Administration" ReadOnly="True"/>
                        <c1:PropertyAttribute MemberName="ModifiedDate" DisplayName="Last Modified" Category="Administration" />
                    </c1:C1PropertyGrid.PropertyAttributes>
                </c1:C1PropertyGrid>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:ProductsViewModel}">
            <Grid>
                <c1:C1PropertyGrid x:Name="c1PropertyGrid1" SelectedObject="{Binding SelectedItem}"
                                   AutoGenerateProperties="False"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   Width="500">
                    <c1:C1PropertyGrid.PropertyAttributes>
                        <c1:PropertyAttribute MemberName="Name" DisplayName="Name" Category="Product Info" />
                        <c1:PropertyAttribute MemberName="ProductNumber" DisplayName="Product Number" Category="Product Info" />
                        <c1:PropertyAttribute MemberName="Color" DisplayName="Color" Category="Product Info" />
                        <c1:PropertyAttribute MemberName="StandardCost" DisplayName="Standard Cost" Category="Sales Info" />
                        <c1:PropertyAttribute MemberName="ListPrice" DisplayName="List Price" Category="Sales Info" />
                        <c1:PropertyAttribute MemberName="Size" DisplayName="Size" Category="Product Info" />
                        <c1:PropertyAttribute MemberName="Weight" DisplayName="Weight" Category="Product Info" />
                        <c1:PropertyAttribute MemberName="SellStartDate" DisplayName="Sell Start Date" Category="Sales Info" />
                        <c1:PropertyAttribute MemberName="SellEndDate" DisplayName="Sell End Date" Category="Sales Info" />
                        <c1:PropertyAttribute MemberName="ProductID" DisplayName="ID" Category="Administration" ReadOnly="True"/>
                        <c1:PropertyAttribute MemberName="ModifiedDate" DisplayName="Last Modified" Category="Administration" />
                    </c1:C1PropertyGrid.PropertyAttributes>
                </c1:C1PropertyGrid>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:OrdersViewModel}">
            <Grid>
                <c1:C1PropertyGrid x:Name="c1PropertyGrid1" SelectedObject="{Binding SelectedItem}"
                                   AutoGenerateProperties="False"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   Width="500">
                    <c1:C1PropertyGrid.PropertyAttributes>
                        <c1:PropertyAttribute MemberName="SalesOrderNumber" DisplayName="Sales Order Number" Category="Order Info" />
                        <c1:PropertyAttribute MemberName="PurchaseOrderNumber" DisplayName="Purchase Order Number" Category="Order Info" />
                        <c1:PropertyAttribute MemberName="AccountNumber" DisplayName="Account Number" Category="Order Info" />
                        <c1:PropertyAttribute MemberName="ShipMethod" DisplayName="Ship Method" Category="Shipping Info" />
                        <c1:PropertyAttribute MemberName="SubTotal" DisplayName="Sub Total" Category="Order Info" />
                        <c1:PropertyAttribute MemberName="TaxAmt" DisplayName="Tax Amount" Category="Order Info" />
                        <c1:PropertyAttribute MemberName="Freight" DisplayName="Freight" Category="Shipping Info" />
                        <c1:PropertyAttribute MemberName="TotalDue" DisplayName="Total Due" Category="Order Info" />
                        <c1:PropertyAttribute MemberName="OnlineOrderFlag" DisplayName="Online Order" Category="Order Info" />
                        <c1:PropertyAttribute MemberName="Status" DisplayName="Status" Category="Order Info" />
                        <c1:PropertyAttribute MemberName="ShipDate" DisplayName="Ship Date" Category="Shipping Info" />
                        <c1:PropertyAttribute MemberName="OrderDate" DisplayName="Order Date" Category="Order Info" />
                        <c1:PropertyAttribute MemberName="DueDate" DisplayName="Due Date" Category="Order Info" />
                        <c1:PropertyAttribute MemberName="SalesOrderID" DisplayName="ID" Category="Administration" ReadOnly="True"/>
                        <c1:PropertyAttribute MemberName="ModifiedDate" DisplayName="Last Modified" Category="Administration" />
                        <c1:PropertyAttribute MemberName="Comment" DisplayName="Comment" Category="Administration" />
                        <!--<c1:PropertyAttribute MemberName="SalesOrderDetails" DisplayName="Sales Order Details" Category="Order Info" />-->
                    </c1:C1PropertyGrid.PropertyAttributes>
                </c1:C1PropertyGrid>
            </Grid>
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <c1:C1ToolbarStrip x:Name="navigatorToolbar" Padding="2 1">
            <c1:C1ToolbarButton x:Name="btnFirst" SmallImageSource="/Resources/DB-First.png" Command="{Binding SelectedDataView.FirstItemCommand}" />
            <c1:C1ToolbarButton x:Name="btnPrevious" SmallImageSource="/Resources/DB-Previous.png" Command="{Binding SelectedDataView.PreviousItemCommand}" />
            <TextBlock Text="Showing" Margin="5 5 2 5" />
            <TextBlock DataContext="{Binding SelectedDataView}" Text="{c1:C1Binding Expression='SelectedItemIndex + 1'}" Margin="2 5 0 5" />
            <TextBlock Text="/"  Margin="2 5"/>
            <TextBlock Text="{Binding SelectedDataView.Count}"  Margin="0 5 2 5"/>
            <TextBlock Text="{Binding SelectedDataView.DisplayName}" Margin="2 5 5 5" />
            <c1:C1ToolbarButton x:Name="btnNext" SmallImageSource="/Resources/DB-Next.png" Command="{Binding SelectedDataView.NextItemCommand}" />
            <c1:C1ToolbarButton x:Name="btnLast" SmallImageSource="/Resources/DB-Last.png" Command="{Binding SelectedDataView.LastItemCommand}" />
            <c1:C1NumericBox x:Name="goToItemBox" ShowButtons="False" Minimum="1" Maximum="{Binding SelectedDataView.Count}"  Margin="5" Width="40"/>
            <c1:C1ToolbarButton LabelTitle="Go to" Command="{Binding SelectedDataView.GoToItemCommand}" CommandParameter="{Binding ElementName=goToItemBox, Path=Value}"/>  
        </c1:C1ToolbarStrip>
        <ContentControl Content="{Binding SelectedDataView}" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top" />
    </Grid>
</UserControl>
