We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

AddNewRowControl Styling

I Try to set the Background color of the AddNewRowControl area. My XAML Looks like that:

      <SolidColorBrush x:Key="Normalbrush" Color="#FF191919"/>
      <SolidColorBrush x:Key="NormalTextbrush" Color="#FF666666"/>

      <Style TargetType="Syncfusion:AddNewRowControl">
         <Setter Property="Background" Value="{StaticResource Normalbrush}"/>
         <Setter Property="Foreground" Value="{StaticResource NormalTextbrush}"/>
      </Style>

but that does only set the Foreground:




1 Reply

JG Jai Ganesh S Syncfusion Team April 4, 2016 11:27 AM UTC

Hi Didi,


You can set the BackGround for AddNewRow by write the style for AddNewRowControl like below,


Code Example:


<Window.Resources>

        <SolidColorBrush x:Key="Normalbrush" Color="#FF191919"/>

        <SolidColorBrush x:Key="NormalTextbrush" Color="#FF666666"/>


        <Style TargetType="Syncfusion:AddNewRowControl">

            <Setter Property="Foreground" Value="{StaticResource NormalTextbrush}" />

            <Setter Property="BorderThickness" Value="0" />

            <Setter Property="Template">

                <Setter.Value>

                    <ControlTemplate TargetType="Syncfusion:AddNewRowControl">

                        <Grid>

                            <VisualStateManager.VisualStateGroups>

                                <VisualStateGroup x:Name="AddNewRowStates">

                                    <VisualState x:Name="Normal" />

                                    <VisualState x:Name="Edit">

                                        <Storyboard>

                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_AddNewRowTextBorder" Storyboard.TargetProperty="(UIElement.Visibility)">

                                                <DiscreteObjectKeyFrame KeyTime="0">

                                                    <DiscreteObjectKeyFrame.Value>

                                                        <Visibility>Collapsed</Visibility>

                                                    </DiscreteObjectKeyFrame.Value>

                                                </DiscreteObjectKeyFrame>

                                            </ObjectAnimationUsingKeyFrames>

                                        </Storyboard>

                                    </VisualState>

                                </VisualStateGroup>

                                <VisualStateGroup x:Name="BorderStates">

                                    <VisualState x:Name="NormalRow" />

                                    <VisualState x:Name="FooterRow">

                                        <Storyboard BeginTime="0">

                                            <ThicknessAnimationUsingKeyFrames BeginTime="0"

                                                                          Duration="1"

                                                                          Storyboard.TargetName="PART_AddNewRowBorder"

                                                                          Storyboard.TargetProperty="BorderThickness">

                                                <EasingThicknessKeyFrame KeyTime="0" Value="0, 1, 0, 0" />

                                            </ThicknessAnimationUsingKeyFrames>

                                            <ThicknessAnimationUsingKeyFrames BeginTime="0"

                                                                          Duration="1"

                                                                          Storyboard.TargetName="PART_AddNewRowBorder"

                                                                          Storyboard.TargetProperty="Margin">

                                                <EasingThicknessKeyFrame KeyTime="0" Value="0, -1, 0, 0" />

                                            </ThicknessAnimationUsingKeyFrames>

                                        </Storyboard>

                                    </VisualState>

                                </VisualStateGroup>

                            </VisualStateManager.VisualStateGroups>

                            <Rectangle x:Name="PART_CurrentFocusRow"

                                   Margin="2,2,0,2"

                                   HorizontalAlignment="Right"

                                   Stroke="{StaticResource Normalbrush}"

                                   StrokeDashArray="2,2"

                                   StrokeThickness="1"

                                   Visibility="{TemplateBinding CurrentFocusRowVisibility}" />

                            <Border Background="{TemplateBinding RowSelectionBrush}"

                                Clip="{TemplateBinding SelectionBorderClipRect}"

                                Visibility="{TemplateBinding SelectionBorderVisiblity}" />

                            <Border x:Name="PART_AddNewRowBorder"

                                Background="{StaticResource Normalbrush}"

                                BorderBrush="{TemplateBinding BorderBrush}"

                                BorderThickness="{TemplateBinding BorderThickness}">

                                <ContentPresenter />

                            </Border>

                            <Border x:Name="PART_AddNewRowTextBorder"

                                Background="{StaticResource Normalbrush}"

                                BorderBrush="Blue"

                                BorderThickness="0,0,1,1"

                                Clip="{TemplateBinding TextBorderClip}"

                                IsHitTestVisible="False">

                                <ContentPresenter Margin="{TemplateBinding TextMargin}"

                                              HorizontalAlignment="Left"

                                              VerticalAlignment="Center"

                                              Content="{TemplateBinding AddNewRowText}" />

                            </Border>

                        </Grid>

                    </ControlTemplate>

                </Setter.Value>

            </Setter>

        </Style>

    </Window.Resources>

   


Sample: http://www.syncfusion.com/downloads/support/directtrac/154013/ze/SfGridDemo1218679471


Regards,

Jai Ganesh S




Loader.
Live Chat Icon For mobile
Up arrow icon