WPF Report Viewer localization using ITextResources interface and embedded .resx files

1 posts, 0 answers
  1. Sebastien
    Sebastien avatar
    7 posts
    Member since:
    Sep 2014

    Posted 08 Nov 2014 Link to this post

    Requirements

    Telerik Product and Version Telerik Reporting Q3 2014+ (probably lower versions as well)
    Platforms WPF
    .NET version .NET 4+
    Visual Studio version VS 2010+
    Programming Language C#

    PROJECT DESCRIPTION 

    The general WPF ReportViewer localization approaches are described in the WPF Report Viewer Localization article.
    The approach in this post - WPF Report Viewer localization using ITextResources interface and embedded .resx files - can be used in order to avoid the deployment of standalone .resx files or the storing of string dictionaries.


    The code in the attachment serves to read standard embedded .resx file and to retrieve localized strings via lambda expressions searching by passed resource key. It is also possible to use multi-locale files e.g., Resource.resx, Resource.fr.resx, Resource.es.resx,.

    To use the provided code create an instance of ReportViewerTextResources by passing the the base name of the resources file. The constructor will create a ResourceManager object based on the calling assembly and the provided resource name.

    Set the ReportViewer TextResources property to the created ReportViewerTextResources  instance:
    this.reportViewer1.TextResources = new ReportViewerTextResources("MyProject.Localization.ReportViewerStringResources");

Back to Top