<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:vm="clr-namespace:OrderEntrySystem">

    <DataTemplate DataType="{x:Type vm:ComputerViewModel}">
        <vm:ProductView></vm:ProductView>
    </DataTemplate>

    <DataTemplate DataType="{x:Type vm:OrderViewModel}">
        <vm:OrderView></vm:OrderView>
    </DataTemplate>

    <DataTemplate DataType="{x:Type vm:CustomerViewModel}">
        <vm:CustomerView></vm:CustomerView>
    </DataTemplate>

    <DataTemplate DataType="{x:Type vm:LocationViewModel}">
        <vm:LocationView></vm:LocationView>
    </DataTemplate>

    <DataTemplate DataType="{x:Type vm:CategoryViewModel}">
        <vm:CategoryView></vm:CategoryView>
    </DataTemplate>

    <DataTemplate DataType="{x:Type vm:ReportViewModel}">
        <vm:ReportView></vm:ReportView>
    </DataTemplate>

    <Style x:Key="ListViewStyle" TargetType="{x:Type ListViewItem}">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}" />
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    
                    <Condition Property="ItemsControl.AlternationIndex" Value="1" />
                    <Condition Property="IsSelected" Value="False" />
                    <Condition Property="IsMouseOver" Value="False" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="#EEEEEEEE" />
            </MultiTrigger>
        </Style.Triggers>
    </Style>

    <DataTemplate x:Key="WorkspacesTemplate">
        <TabControl IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" Margin="4">
            <TabControl.ItemTemplate>
                <DataTemplate>
                    <DockPanel>
                        <Button Content="X" DockPanel.Dock="Right" Cursor="Hand"
                                Margin="4,0,0,0" FontWeight="Bold" Height="16" Width="16"
                                FontFamily="Courier" FontSize="9" Command="{Binding Path=CloseCommand}" />
                        <ContentPresenter Content="{Binding Path=DisplayName}" VerticalAlignment="Center"/>
                    </DockPanel>
                </DataTemplate>
            </TabControl.ItemTemplate>
        </TabControl>
    </DataTemplate>

    <DataTemplate x:Key="NestedCommandTemplate">
        <ItemsControl ItemsSource="{Binding}" HorizontalAlignment="Right">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Button Command="{Binding Path=Command}" Content="{Binding Path=DisplayName}" IsDefault="{Binding Path=IsDefault}" IsCancel="{Binding Path=IsCancel}" Height="23" Width="75" Margin="4,4,0,0"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </DataTemplate>

    <CollectionViewSource x:Key="CommandGroups" Source="{Binding Path=Commands}">
        <CollectionViewSource.GroupDescriptions>
            <PropertyGroupDescription PropertyName="GroupName" />
        </CollectionViewSource.GroupDescriptions>
    </CollectionViewSource>

    <DataTemplate x:Key="CommandsTemplate">
        <ItemsControl ItemsSource="{Binding Source={StaticResource CommandGroups}}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Button Command="{Binding Path=Command}" Content="{Binding Path=DisplayName}" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
            <ItemsControl.GroupStyle>
                <GroupStyle>
                    <GroupStyle.ContainerStyle>
                        <Style TargetType="{x:Type GroupItem}">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type GroupItem}">
                                        <Expander Header="{Binding Path=Name}" IsExpanded="True">
                                            <ItemsPresenter/>
                                        </Expander>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </GroupStyle.ContainerStyle>
                </GroupStyle>
            </ItemsControl.GroupStyle>
        </ItemsControl>
    </DataTemplate>

    <Style x:Key="MainHeaderStyle" TargetType="{x:Type HeaderedContentControl}">
        <Setter Property="HeaderTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border Background="{StaticResource Brush_HeaderBackground}" BorderBrush="LightGray" BorderThickness="1" 
                            CornerRadius="5" Margin="4" Padding="4" SnapsToDevicePixels="True">
                        <TextBlock FontSize="14" FontWeight="Bold" Foreground="White" HorizontalAlignment="Center" Text="{TemplateBinding Content}" />
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <!-- This template ensures that content of a HeaderedContentControl fills the available vertical space. -->
                <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
                    <DockPanel>
                        <ContentPresenter DockPanel.Dock="Top" ContentSource="Header" ContentTemplate="{TemplateBinding HeaderTemplate}" />
                        <ContentPresenter ContentSource="Content" ContentTemplate="{TemplateBinding ContentTemplate}" />
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ValidationStyleTextBox" TargetType="{x:Type TextBox}">
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="True">
                <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors).CurrentItem.ErrorContent}" />
                <Setter Property="Validation.ErrorTemplate">
                    <Setter.Value>
                        <ControlTemplate>
                            <DockPanel LastChildFill="true">
                                <TextBlock DockPanel.Dock="Right" VerticalAlignment="Center" Margin="5,0,0,0" Text="{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors).CurrentItem.ErrorContent}" />
                                <Border Background="Red" DockPanel.Dock="right" Margin="5,0,0,0" Width="20" Height="20" CornerRadius="10">
                                    <TextBlock Text="!" VerticalAlignment="center" HorizontalAlignment="center" FontWeight="Bold" Foreground="white" />
                                </Border>
                                <AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center" >
                                    <Border BorderBrush="red" BorderThickness="1" />
                                </AdornedElementPlaceholder>
                            </DockPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="PagingButton" TargetType="{x:Type Button}">
        <Setter Property="FontFamily" Value="Webdings" />
        <Setter Property="Height" Value="23" />
        <Setter Property="Width" Value="45" />
        <Setter Property="Margin" Value="4,0,4,0" />
    </Style>

    <Style x:Key="PagingTextBlock" TargetType="{x:Type TextBlock}">
        <Setter Property="Margin" Value="4,0,4,0" />
        <Setter Property="VerticalAlignment" Value="Center" />
    </Style>

</ResourceDictionary>