Hi,
I'm starting to practice with Syncfusion controls developing a simple WPF MVVM app.
Is there a way to customize the "click here to add a new row" label appearing in the new row placeholder?
I would like to translate it in italian.
Thanks
Giacomo
<Style TargetType="syncfusion:AddNewRowControl">
<Setter Property="Foreground" Value="White" />
<Setter Property="BorderBrush" Value="Gray" />
<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="DarkGray"
StrokeDashArray="2,2"
StrokeThickness="1"
Visibility="{TemplateBinding CurrentFocusRowVisibility}" />
<Border Background="{TemplateBinding RowSelectionBrush}"
Clip="{TemplateBinding SelectionBorderClipRect}"
Visibility="{TemplateBinding SelectionBorderVisiblity}" />
<Border x:Name="PART_AddNewRowBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter />
</Border>
<Border x:Name="PART_AddNewRowTextBorder"
Background="#FFE5E5E5"
BorderBrush="Transparent"
BorderThickness="0,0,1,1"
Clip="{TemplateBinding TextBorderClip}"
IsHitTestVisible="False">
<ContentPresenter Margin="{TemplateBinding TextMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Content="Add New Row" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> |
Syncfusion.SfDataGrid.WPF.resx
file in Resources folder and then customize the value of AddNewRowText. Hi Srinivasan,
thank you for your reply.
Apologize if I could find the solution in your documentation without direct support, I will learn to better read it soon.
I am trying the second way because I find it more proper and elegant than customize the style for a single label but I am not achieving my goal.
Here are my steps:
but the text is still "Click here to add a new row".
I also changed the compile action setting it to "Resource" without success.
You can see all of this summarized in the attached picture
Where am I wrong?
Thanks
Giacomo
Dear Giacomo,
I'm glad to answer you since I'm italian too, and I'm developing with this library in WPF for more than one year.
Of course I soon had your same requirement to localize in Italian the English parts of the library and probably had your same problems.
Probably this little article can help you:
https://www.syncfusion.com/kb/5962/how-to-localize-when-resource-file-present-in-different-assembly-or-default-namespace-is-not-same-as
In addition, I show you in the attached zip file how I have solved the problem in my application.
I added a directory named "Resources" in the Assembly that manages my views and inserted in it two resource files that I probably changed more than one year ago, and it works.
See the attached zip file. Hope it can help you.
Ciao e buon lavoro !!!!
Io mi trovo molto bene con l'utilizzo di queste librerie.
Silvio Scattaglia, Infolab Piacenza
Ciao Silvio,
it's nice to find you here!
Thanks for your help, I solved the problem: it was for I added the .resx file as a project resource rather than manually adding a "Resources" folder in solution explorer and then add into it the .resx file.
Now it works perfectly!
Thanks again, read you soon!
Giacomo