<UserControl xmlns:my="clr-namespace:SalesAnalysis"  xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"  x:Class="SalesAnalysis.Invoice"
             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:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
             xmlns:tk="http://schemas.xceed.com/wpf/xaml/toolkit"
             mc:Ignorable="d" 
             d:DesignWidth="640" d:DesignHeight="480" Loaded="UserControl_Loaded">
    <Grid x:Name="LayoutRoot">
        <Grid x:Name="MainGrid" Style="{StaticResource ContentStackPanelStyle}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <!-- header area -->
            <StackPanel x:Name="ContentStackPanel" >
                <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" Text="Invoices" ></TextBlock>
                <TextBlock x:Name="ContentText" Style="{StaticResource ContentTextStyle}" Text="NorthWind Invoices"/>
            </StackPanel>
            <StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal" >
                <TextBlock Text="Product Filter:" Margin="5 0 5 0" VerticalAlignment="Center" />
                <Border Background="White" BorderBrush="#ffe7ebe7" BorderThickness="2" CornerRadius="8" Padding="8 0 12 0">
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="_txtFilter" BorderThickness="0" Padding="0" Width="120" VerticalAlignment="Center" TextChanged="_txtFilter_TextChanged" />
                        <Image   MouseLeftButtonDown="_imgFilter_MouseLeftButtonDown"  Source="/SalesAnalysis;component/Images/search.png" />
                    </StackPanel>
                </Border>
                <Button Name="_btnSave" Content="Save..." Margin="5 0" VerticalAlignment="Center" Click="_btnSave_Click"></Button>
                <Button Name="_btnPrint" Content="Print..." Margin="5 0" VerticalAlignment="Center" Click="_btnPrint_Click"></Button>
            </StackPanel>
            <!-- Invoices grid -->
            <c1:C1FlexGrid
                Name="_flex" Grid.Row="1"
                AutoGenerateColumns="False" 
                ItemsSource="{Binding Data, ElementName=_ddsInvoices}" 
                BorderBrush="DarkGray" BorderThickness="1" FontFamily="Segoe UI"
                AreRowGroupHeadersFrozen="False"
                ShowMarquee="True"
                GridLinesVisibility="None"
                RowBackground="Transparent"
                AlternatingRowBackground="Transparent" 
                CursorBackground="Transparent" 
                EditorBackground="Transparent" 
                TopLeftCellBackground="#FFC6C6C6"
                RowHeaderBackground="#FFE7E7E7" 
                RowHeaderSelectedBackground="#FFF5C795" 
                GridLinesBrush="#FFD0D7E5"
                HeaderGridLinesBrush="#FF909192" 
                SelectionBackground="#FFEAECF5">
                <c1:C1FlexGrid.ColumnHeaderSelectedBackground>
                    <LinearGradientBrush EndPoint="0,1">
                        <GradientStop Color="#FFFFC996" Offset="0" />
                        <GradientStop Color="#FFFF9B68" Offset="1" />
                    </LinearGradientBrush>
                </c1:C1FlexGrid.ColumnHeaderSelectedBackground>
                <c1:C1FlexGrid.ColumnHeaderBackground>
                    <LinearGradientBrush EndPoint="0,1">
                        <GradientStop Color="#FFF1F3F3" Offset="0" />
                        <GradientStop Color="#FFC8C9CA" Offset="1" />
                    </LinearGradientBrush>
                </c1:C1FlexGrid.ColumnHeaderBackground>
                <c1:C1FlexGrid.Columns>
                    <c1:Column Header="Order Date" Binding="{Binding OrderDate, StringFormat='d'}" Width="*"/>
                    <c1:Column Header="Salesperson" Binding="{Binding Salesperson}" Width="2*" TextTrimming="WordEllipsis" />
                    <c1:Column Header="Product" Binding="{Binding ProductName}" Width="2*" TextTrimming="WordEllipsis" />
                    <c1:Column Header="Unit Price" Binding="{Binding UnitPrice, StringFormat='n2'}" Width="*" HorizontalAlignment="Right" />
                    <c1:Column Header="Quantity" Binding="{Binding Quantity, StringFormat='n0'}" Width="*" HorizontalAlignment="Right" />
                    <c1:Column Header="Discount" Binding="{Binding Discount, StringFormat='p0'}" Width="*" HorizontalAlignment="Right" />
                    <c1:Column Header="Total Amount" Binding="{Binding ExtendedPrice, StringFormat='n2'}" Width="*" HorizontalAlignment="Right" GroupAggregate="Sum" />
                </c1:C1FlexGrid.Columns>
            </c1:C1FlexGrid>
            <!-- status bar -->
            <TextBlock Name="_tbStatus" Grid.Row="3" HorizontalAlignment="Right" Margin="0 6 0 4" />
            <TextBlock Grid.Row="3" Text=" "  Margin="0 6 0 4" />

        </Grid>
       
    </Grid>
</UserControl>
