none
Reference resource strings from another assembly RRS feed

  • Question

  • I have an assembly, "vImages", which provides images and it contains a resource file that has the names and paths to all the images.

    I strongly typed it by downloading StronglyTypedResourceBuilder from NuGet.

    I imported the vImages namespace like this:

    xmlns:resources="clr-namespace:vImages.Resources;assembly=vImages"

    and then added this inside the <Gird> tag which is how I do it for Silverlight:

    <Grid.Resources>
        <resources:StringsVelocityImagePaths  x:Key="imgPath"  />
    </Grid.Resources>

    and I get this error message:

    <<<

    The name "StringsVelocityImagePaths" does not exist in the namespace "clr-namespace:vImages.Resources;assembly=vImages".

    >>>

    When type this XAML, StringsVelocityImagePaths is recognized as you can see in the screenshot below, so it seems that all should be OK.

    what's the correct way to do this in WPF?

    Thank you.


    • Edited by moondaddy Monday, July 17, 2017 10:23 PM forgot image
    • Moved by Bob Ding Friday, July 21, 2017 7:17 AM third party source
    Monday, July 17, 2017 10:15 PM

Answers

All replies

  • Hi,

    I think your question really should not ask in WPF forum, because this extension is not provided by Microsoft. The best place you should ask for your question how to use this extension is asking directly to this extended contributor.

    I never use this tool, and I download this tool for visual studio 2015 to test.

    I look at this description for this tool, it said that it is automatically associated with resources (.resx files) every time they are added into a project.

    So, I think you have a wrong usage with this tool, It works for resources(.resx file), not WPF Resource. 

    Am I right? 

    Best Regards,

    Bob


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 18, 2017 5:40 AM
  • Hi Bob,

    Never mind the tool, all it does is convert the resource file into a strongly typed resource file automatically, otherwise I have to do it to 100s manually.  In short, it edits the code behind changing "internal" to "public"

    public class Resource1 {
            
        private static global::System.Resources.ResourceManager resourceMan;
            
        private static global::System.Globalization.CultureInfo resourceCulture;
            
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resource1() {
        }
    
    to
    
     public Resource1() {
        }
    Maybe I have a syntax error somewhere. 

    Wednesday, July 19, 2017 3:33 AM
  • Hi Bob,

    Never mind the tool, all it does is convert the resource file into a strongly typed resource file automatically, otherwise I have to do it to 100s manually.  In short, it edits the code behind changing "internal" to "public"

    public class Resource1 {
            
        private static global::System.Resources.ResourceManager resourceMan;
            
        private static global::System.Globalization.CultureInfo resourceCulture;
            
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resource1() {
        }
    
    to
    
     public Resource1() {
        }

    Hi moondaddy,

    Your explanation is very good, .NET seem like provide the StronglyTypedResourceBuilder Class.

    Maybe you can achieve it by yourself.

    How to achieve breakpoint resume when upload big file to blob (VS2013)

    and maybe you should check the syntax error like misspellings ,and note the assamble version of .net.  refer the following link to narrow down the scope of the problem.

    The tag 'XXX' does not exist in XML namespace 'clr-namespace:YYY'

    tag does not exist in XML namespace

    The tag “xxx” does not exist in XML namespace“yyy” / Reference could not be foundBest Regards,

    Bob


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    • Marked as answer by moondaddy Tuesday, July 25, 2017 11:21 PM
    • Edited by Bob Ding Wednesday, July 26, 2017 1:13 AM
    Wednesday, July 19, 2017 4:34 AM