<UserControl x:Class="DataGridSamples.ConditionalFormat"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"
      xmlns:local="clr-namespace:DataGridSamples"
      xmlns:helpers="clr-namespace:Helpers"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>

            <SolidColorBrush x:Key="WarningBrush" Color="#FFFFFF72" />
            <SolidColorBrush x:Key="DelayBrush" Color="Orange" />
            <SolidColorBrush x:Key="ProblemBrush" Color="#FFA71818" />

            <Style x:Key="BorderStyle" TargetType="Border">
                <Setter Property="BorderBrush" Value="#FF444444" />
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="Width" Value="15" />
                <Setter Property="Height" Value="15" />
            </Style>

            <Style x:Key="LegendStyle" TargetType="TextBlock">
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="Margin" Value="4 0 25 0" />
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <!-- Property Editors -->
        <Border Visibility="Collapsed">
            <WrapPanel ItemWidth="230" >
            </WrapPanel>
        </Border>

        <!-- Control instance -->
        <Border Grid.Row="1" >
            <Grid >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal" Margin="0 0 0 10">
                    <Border Style="{StaticResource BorderStyle}" Background="{StaticResource WarningBrush}"/>
                    <TextBlock Style="{StaticResource LegendStyle}" Text="Warning"/>
                    <Border Style="{StaticResource BorderStyle}" Background="{StaticResource DelayBrush}"/>
                    <TextBlock Style="{StaticResource LegendStyle}" Text="Small Delay"/>
                    <Border Style="{StaticResource BorderStyle}" Background="{StaticResource ProblemBrush}"/>
                    <TextBlock Style="{StaticResource LegendStyle}" Text="Huge Delay"/>
                </StackPanel>

                <c1:C1DataGrid x:Name="grid"
                         Grid.Row="1"
                         CanUserAddRows="False"
                         RowHeight="30"
                         IsReadOnly="true" AutoGenerateColumns="False">
                    <c1:C1DataGrid.Columns>
                        <c1:DataGridTextColumn Binding="{Binding ProductName, Mode=TwoWay}" FilterMemberPath="ProductName" SortMemberPath="ProductName" Header="Product" />
                        <c1:DataGridNumericColumn Binding="{Binding Price, Mode=TwoWay}" FilterMemberPath="Price" SortMemberPath="Price" Header="Price"  Format="c" />
                        <c1:DataGridDateTimeColumn Binding="{Binding ReadyForDelivery, Mode=TwoWay}" FilterMemberPath="ReadyForDelivery" SortMemberPath="ReadyForDelivery" Header="Will be Ready" Format="d" />
                        <c1:DataGridTextColumn Binding="{Binding DeliveryDays, Mode=TwoWay}" FilterMemberPath="DeliveryDays" SortMemberPath="DeliveryDays" Header="Delivery Days" />
                        <c1:DataGridDateTimeColumn Binding="{Binding ExpectedDelivery, Mode=TwoWay}" FilterMemberPath="ExpectedDelivery" SortMemberPath="ExpectedDelivery" Header="Expected Delivery" Format="d" />
                    </c1:C1DataGrid.Columns>
                </c1:C1DataGrid>
            </Grid>
        </Border>
    </Grid>
</UserControl>
