	  
	   
    
		

<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">
	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="/C1.WPF.4;component/themes/Common.xaml" />
		<ResourceDictionary Source="/C1.WPF.DataGrid.4;component/themes/Common.xaml" />
	</ResourceDictionary.MergedDictionaries>
	<!--******************** Cell Presenter ********************-->
	<!-- Brush @ C1DataGrid Cell Border Focused -->
    
    
    <SolidColorBrush x:Key="DataGridCellFocusBrush" Color="#CC8ED1E2" />
	<!-- DataGridFocusPresenter Style -->
	<Style TargetType="c1DataGrid:DataGridFocusPresenter">
		<Setter Property="IsHitTestVisible" Value="false" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="c1DataGrid:DataGridFocusPresenter">
                    <Rectangle Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

    <Style TargetType="Rectangle" x:Key="LinesStyle">
        <Setter Property="IsHitTestVisible" Value="false" />
        <Setter Property="StrokeThickness" Value="0" />
    </Style>

    <!-- DataGridCellPresenter Style -->
	<Style TargetType="c1DataGrid:DataGridCellPresenter">
		<Setter Property="HorizontalContentAlignment" Value="Stretch" />
		<Setter Property="VerticalContentAlignment" Value="Stretch" />
		<!--This property must be set, else the HitTest method doesn't find the cell-->
		<Setter Property="Background" Value="Transparent" />
        <Setter Property="ValidationBackground" Value="{StaticResource ValidationBaseColorBrush}" />
        <Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="c1DataGrid:DataGridCellPresenter">
					<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="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
							</VisualStateGroup>
							<VisualStateGroup x:Name="SelectionStates">
								<VisualState x:Name="Unselected" />
								<VisualState x:Name="Editing" />
								<VisualState x:Name="Current">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
								<VisualState x:Name="CurrentSelected">
									<Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentSelectedElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                     </Storyboard>
								</VisualState>
								<VisualState x:Name="Selected">
									<Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectedElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
							<VisualStateGroup x:Name="ValidationStates">
								<VisualState x:Name="Valid" />
								<VisualState x:Name="InvalidUnfocused">
									<Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Validation" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="InvalidFocused">
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="*" />
							<ColumnDefinition Width="Auto" />
						</Grid.ColumnDefinitions>
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto" />
							<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="CurrentSelectedBrush" Input="{TemplateBinding SelectedBackground}" DesignBrush="{StaticResource DataGridCellFocusBrush}" DesignColor="{StaticResource SelectedColor}" />
						<c1:C1BrushBuilder x:Name="MouseOverBrush" Input="{TemplateBinding MouseOverBrush}" DesignBrush="{StaticResource DataGridRowOverBrush}" DesignColor="{StaticResource MouseOverColor}" />                        
                        <Grid Background="{TemplateBinding Background}" Grid.Column="1" Grid.Row="1">
                            <Rectangle x:Name="SelectedElement" Fill="{Binding ElementName=SelectedBackground,Path=Output}" StrokeThickness="0" Visibility="Collapsed" IsHitTestVisible="False" />
                            <Rectangle x:Name="CurrentSelectedElement" Fill="{Binding ElementName=CurrentSelectedBrush,Path=Output}" StrokeThickness="0" Visibility="Collapsed" IsHitTestVisible="False" />
                            <c1DataGrid:DataGridFocusPresenter x:Name="FocusElement" BorderBrush="{TemplateBinding SelectedBackground}" Style="{TemplateBinding FocusStyle}" Visibility="Collapsed" />
                            <Rectangle x:Name="MouseOverElement" Fill="{Binding ElementName=MouseOverBrush,Path=Output}" StrokeThickness="0" Visibility="Collapsed" IsHitTestVisible="False" />
                            <ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" />
                            <Rectangle x:Name="Validation" Stroke="{TemplateBinding ValidationBackground}" StrokeThickness="1" Visibility="Collapsed" />
                        </Grid>
                        <Rectangle x:Name="LeftLine" Grid.Column="0" Grid.RowSpan="3" Style="{StaticResource LinesStyle}" />
                        <Rectangle x:Name="TopLine" Grid.Row="0" Grid.ColumnSpan="3" Style="{StaticResource LinesStyle}" />
                        <Rectangle x:Name="RightLine" Grid.Column="2" Grid.RowSpan="3" Style="{StaticResource LinesStyle}" />
                        <Rectangle x:Name="BottomLine" Grid.Row="2" Grid.ColumnSpan="3" Style="{StaticResource LinesStyle}" />
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>
