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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

AddNewRowControl Styling

Thread ID:

Created:

Updated:

Platform:

Replies:

123590 Apr 1,2016 04:35 PM UTC Apr 4,2016 11:27 AM UTC WPF 1
loading
Tags: SfDataGrid
Didi Kunz
Asked On April 1, 2016 04:35 PM UTC

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:




Jai Ganesh S [Syncfusion]
Replied On 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




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;