This is a migrated thread and some comments may be shown as answers.

CustomText for GridViewNewRow with built-in localization mechanism

4 Answers 40 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 11 Oct 2016, 09:08 AM

I read this document CustomText for GridViewNewRow

But I'm using built-in localization mechanism.

How can I do?

4 Answers, 1 is accepted

Sort by
1
Stefan Nenchev
Telerik team
answered on 13 Oct 2016, 10:09 AM
Hi Dario,

As the article explains, you need to create a custom class that inherits the default LocalizationManager class and override the string value for the GridViewNewRow. What is stopping you from using such approach?

Another possibility is to find the TextBlock element within the New Row which contains the Text Value once the RadGridView is loaded:

private void clubsGrid_Loaded(object sender, RoutedEventArgs e)
       {
           var newRowTextBlock = this.clubsGrid.ChildrenOfType<TextBlock>().Where(x => x.ParentOfType<Border>().Name == "PART_AlwaysVisibleNewRow").FirstOrDefault();
           if (newRowTextBlock != null)
           {
               newRowTextBlock.Text = "Some Text";
           }
       }

I have added a sample project for your reference that implements both approaches. Please review it and consider which approach fits scenario the best.

Regards,
Stefan Nenchev
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Nathan
Top achievements
Rank 1
Iron
commented on 29 Jun 2021, 07:34 PM

This is the best solution IMO.

But if you are having the same problem, please vote on this: https://feedback.telerik.com/wpf/1411620-gridview-introduce-property-to-set-the-text-of-the-gridviewnewrow

Thanks
0
Dario Concilio
Top achievements
Rank 2
answered on 13 Oct 2016, 10:39 AM

My problem is that I need to built-in localization for all controls.

If I use LocalizationManager and create CustomResource, Will I lose all the built-in's translations?

0
Accepted
Stefan Nenchev
Telerik team
answered on 17 Oct 2016, 02:26 PM
Hi Dario,

The approach suggested in the article would not break the localization that you have applied and will affect only the New Row string. I have added a sample project for your reference which uses an Italian Localization and changes the NewRow text. 

If you have any further questions or concerns, do not hesitate to contact us.

Regards,
Stefan Nenchev
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dario Concilio
Top achievements
Rank 2
answered on 18 Oct 2016, 10:35 AM

Perfect! It works correctly.

 

Thank you.

Tags
GridView
Asked by
Dario Concilio
Top achievements
Rank 2
Answers by
Stefan Nenchev
Telerik team
Dario Concilio
Top achievements
Rank 2
Share this question
or