	  
	   
    
		

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="clr-namespace:C1.WPF;assembly=C1.WPF.4" xmlns:c1DataGrid="clr-namespace:C1.WPF.DataGrid" xmlns:c1DataGrid_Resources="clr-namespace:C1.Silverlight.DataGrid.Resources">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/C1.WPF.4;component/themes/Common.xaml" />
        <ResourceDictionary Source="/C1.WPF.DataGrid.4;component/themes/Common.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!--******************** Row Presenter ********************-->

    <c1DataGrid_Resources:C1_Silverlight_DataGrid x:Key="DataGridResources" />
    <!--Use x:Key instead of x:Name to avoid blend issues-->

    <!-- DataGridRowPresenter Style -->
    <Style TargetType="c1DataGrid:DataGridRowPresenter">
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="ValidationBackground" Value="{StaticResource ValidationBaseColorBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1DataGrid:DataGridRowPresenter">
                    <Grid x:Name="Root" Margin="{TemplateBinding CellsAreaMargin}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Validation" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0">
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0.17" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="BackgroundElement" Background="{TemplateBinding BackgroundBrush}" />
                        <Border x:Name="UserBackground" Background="{TemplateBinding Background}" />
                        <Border x:Name="Validation" Background="{TemplateBinding ValidationBackground}" Opacity="0" />
                        <c1DataGrid:DataGridCellsPanel x:Name="Cells" />
                        <Rectangle x:Name="HorizontalGridLine" Grid.Row="1" Height="1" Fill="{TemplateBinding HorizontalGridLineBrush}" Visibility="{TemplateBinding HorizontalGridLineVisibility}" Opacity="{TemplateBinding HorizontalGridLineOpacity}" VerticalAlignment="Bottom" />
                        <Rectangle x:Name="VerticalGridLine" Width="1" Fill="{TemplateBinding VerticalGridLineBrush}" Visibility="{TemplateBinding VerticalGridLineVisibility}" HorizontalAlignment="Left" Margin="-1 0 0 0" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- DataGridSelectableRowPresenter Style -->
    <Style TargetType="c1DataGrid:DataGridSelectableRowPresenter">
        <Setter Property="ValidationBackground" Value="{StaticResource ValidationBaseColorBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1DataGrid:DataGridSelectableRowPresenter">
                    <Grid x:Name="Root" Margin="{TemplateBinding CellsAreaMargin}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Editing">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unselected" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Validation" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0">
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0.17" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <c1:C1BrushBuilder x:Name="SelectedBackground" Input="{TemplateBinding SelectedBackground}" DesignBrush="{StaticResource DataGridRowSelectedBackground}" DesignColor="{StaticResource SelectedColor}" />
                        <c1:C1BrushBuilder x:Name="MouseOverBorderBrush" Input="{TemplateBinding MouseOverBrush}" DesignBrush="{StaticResource DataGridRowOverBrush}" DesignColor="{StaticResource SelectedColor}" />
                        <Border x:Name="BackgroundElement" Background="{TemplateBinding BackgroundBrush}" />
                        <Border x:Name="UserBackground" Background="{TemplateBinding Background}" />
                        <Border x:Name="Validation" Background="{TemplateBinding ValidationBackground}" Opacity="0" />
                        <Border x:Name="SelectedElement" Background="{TemplateBinding SelectedBackground}" Visibility="Collapsed" />
                        <Border x:Name="MouseOverElement" Background="{Binding ElementName=MouseOverBorderBrush, Path=Output}" Visibility="Collapsed" />
                        <c1DataGrid:DataGridCellsPanel x:Name="Cells" />
                        <Rectangle x:Name="HorizontalGridLine" Grid.Row="1" Height="1" Fill="{TemplateBinding HorizontalGridLineBrush}" Visibility="{TemplateBinding HorizontalGridLineVisibility}" Opacity="{TemplateBinding HorizontalGridLineOpacity}" />
                        <Rectangle x:Name="VerticalGridLine" Width="1" Fill="{TemplateBinding VerticalGridLineBrush}" Visibility="{TemplateBinding VerticalGridLineVisibility}" HorizontalAlignment="Left" Margin="-1 0 0 0" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!--******************** New Row Presenter ********************-->

    <!-- Brush @ C1DataGrid NewRowPresenter Background -->
    <SolidColorBrush x:Key="DataGridNewRowBrush" Color="#FFD9E4ED" />
    <!-- Thickness @ C1DataGrid NewRowPresenter on MouseOver -->
    <Thickness x:Key="DataGridNewRowOverBorderThickness">0 1 0 1</Thickness>
    <!-- Thickness @ C1DataGrid NewRowPresenter Selected -->
    <Thickness x:Key="DataGridNewRowSelectedBorderThickness">0 1 0 1</Thickness>

    <!-- DataGridNewRowPresenter Style-->
    <Style TargetType="c1DataGrid:DataGridNewRowPresenter">
        <Setter Property="ValidationBackground" Value="{StaticResource ValidationBaseColorBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1DataGrid:DataGridNewRowPresenter">
                    <Grid x:Name="Root" Margin="{TemplateBinding CellsAreaMargin}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Editing">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unselected" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Validation" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0">
                                            <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0.17" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <c1:C1BrushBuilder x:Name="BackgroundBrush" Input="{TemplateBinding BackgroundBrush}" DesignBrush="{StaticResource DataGridNewRowBrush}" DesignColor="{StaticResource BaseColor}" />
                        <c1:C1BrushBuilder x:Name="SelectedBackground" Input="{TemplateBinding SelectedBackground}" DesignBrush="{StaticResource DataGridRowSelectedBackground}" DesignColor="{StaticResource SelectedColor}" />
                        <c1:C1BrushBuilder x:Name="MouseOverBorderBrush" Input="{TemplateBinding MouseOverBrush}" DesignBrush="{StaticResource DataGridRowOverBrush}" DesignColor="{StaticResource SelectedColor}" />
                        <Border x:Name="BackgroundElement" Grid.RowSpan="3" Background="{Binding ElementName=BackgroundBrush, Path=Output}" />
                        <Border x:Name="UserBackground" Background="{TemplateBinding Background}" />
                        <Border x:Name="Validation" Background="{TemplateBinding ValidationBackground}" Opacity="0" />
                        <Border x:Name="SelectedElement" Grid.RowSpan="3" Background="{TemplateBinding SelectedBackground}" BorderThickness="{StaticResource DataGridNewRowSelectedBorderThickness}" Visibility="Collapsed" />
                        <Border x:Name="MouseOverElement" Grid.RowSpan="3" Background="{Binding ElementName=MouseOverBorderBrush, Path=Output}" BorderThickness="{StaticResource DataGridNewRowOverBorderThickness}" Visibility="Collapsed" />
                        <c1DataGrid:DataGridCellsPanel x:Name="Cells" Opacity="0" />
                        <Rectangle x:Name="VerticalGridLine" Width="1" Fill="{TemplateBinding VerticalGridLineBrush}" Visibility="{TemplateBinding VerticalGridLineVisibility}" HorizontalAlignment="Left" Margin="-1 0 0 0" />
                        <TextBlock x:Name="Watermark" Margin="4" VerticalAlignment="Center" Text="{TemplateBinding WatermarkText}" IsHitTestVisible="False" Opacity="0.7" />
                        <Rectangle x:Name="HorizontalGridLine" Grid.Row="1" Height="1" Fill="{TemplateBinding HorizontalGridLineBrush}" Visibility="{TemplateBinding HorizontalGridLineVisibility}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!--******************* Group Row Presenter ********************-->

    <!-- Brush @ C1DataGrid GroupRow Background -->
    <LinearGradientBrush x:Key="DataGridGroupRowBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFBBCBDA" Offset="0" />
        <GradientStop Color="#FFD6DFE7" Offset="0.07" />
        <GradientStop Color="#FFD6DFE7" Offset="0.3" />
        <GradientStop Color="#FFBBCBDA" Offset="0.7" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="DataGridGroupRowOverBrush" Color="#FFAFD4E1" />
    <SolidColorBrush x:Key="DataGridGroupRowSelectedBackground" Color="#FFA4DEED" />

    <!-- DataGridToggleGroupButton @ C1DataGrid Group -->
    <Style x:Key="DataGridGroupTButtonStyle" TargetType="c1DataGrid:DataGridToggleGroupButton">
        <Setter Property="Margin" Value="6 0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1DataGrid:DataGridToggleGroupButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Pressed" />
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="path1" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <c1:C1BrushBuilder x:Name="BackgroundBrush" Input="{TemplateBinding Background}" DesignBrush="{StaticResource GeneralGradientBrush}" DesignColor="{StaticResource BaseColor}" />
                        <Border x:Name="BackgroundElement" Background="{Binding Output, ElementName=BackgroundBrush}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{StaticResource DataGridBorderThickness}" CornerRadius="{StaticResource DataGridGeneralCornerRadius}" />
                        <Grid>
                            <Grid x:Name="icos">
                                <Rectangle x:Name="path" Fill="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center" Height="1" Width="5" Visibility="Collapsed" />
                                <Rectangle x:Name="path1" Fill="{TemplateBinding Foreground}" Height="5" Width="1" Visibility="Collapsed" />
                            </Grid>
                        </Grid>
                        <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- DataGridGroupRowPresenter Style -->
    <Style TargetType="c1DataGrid:DataGridGroupRowPresenter">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1DataGrid:DataGridGroupRowPresenter">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unselected" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid Margin="{TemplateBinding RowAreaMargin}">
                            <c1:C1BrushBuilder x:Name="BackgroundBrush" Input="{TemplateBinding BackgroundBrush}" DesignBrush="{StaticResource DataGridGroupRowBrush}" DesignColor="{StaticResource BaseColor}" />
                            <c1:C1BrushBuilder x:Name="SelectedBackground" Input="{TemplateBinding SelectedBackground}" DesignBrush="{StaticResource DataGridGroupRowSelectedBackground}" DesignColor="{StaticResource SelectedColor}" />
                            <c1:C1BrushBuilder x:Name="MouseOverBrush" Input="{TemplateBinding MouseOverBrush}" DesignBrush="{StaticResource DataGridGroupRowOverBrush}" DesignColor="{StaticResource MouseOverColor}" />
                            <Border x:Name="BackgroundElement" Background="{Binding ElementName=BackgroundBrush, Path=Output}" />
                            <Border x:Name="UserBackground" Background="{TemplateBinding Background}" />
                            <Border x:Name="SelectedElement" Background="{Binding ElementName=SelectedBackground, Path=Output}" Visibility="Collapsed" />
                            <Border x:Name="MouseOverElement" Background="{Binding ElementName=MouseOverBrush, Path=Output}" Visibility="Collapsed" />
                            <Grid Margin="{TemplateBinding GroupContentMargin}" VerticalAlignment="Center" HorizontalAlignment="Left">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <c1DataGrid:DataGridToggleGroupButton x:Name="ToggleGroup" Width="11" Height="11" Background="{TemplateBinding ButtonBackground}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{StaticResource DataGridBorderThickness}" Foreground="{TemplateBinding ButtonForeground}" Style="{StaticResource DataGridGroupTButtonStyle}" />
                                <ContentPresenter x:Name="GroupName" Grid.Column="1" />
                            </Grid>
                        </Grid>
                        <c1DataGrid:DataGridCellsPanel x:Name="Cells" Margin="{TemplateBinding CellsAreaMargin}" />
                        <Rectangle x:Name="HorizontalGridLine" Margin="{TemplateBinding RowAreaMargin}" Grid.Row="1" Height="1" Fill="{TemplateBinding HorizontalGridLineBrush}" Visibility="{TemplateBinding HorizontalGridLineVisibility}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
