Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 365777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:34:10+00:00 2026-05-12T13:34:10+00:00

Is there a way to access My.Resources thru Xaml? Like this <Image Source={Binding MyImage,

  • 0

Is there a way to access My.Resources thru Xaml?

Like this

<Image Source="{Binding MyImage,
    Source={x:Static my:Resources},
    Converter={StaticResource MyBitmapToImageSourceConverter}}" />

This is the error I get:
\Application.xaml(122,36): error MC3029: ‘my:Resources’ member is not valid because it does not have a qualifying type name.

The above doesn’t work of course.

NOTE: The converter is for illustration only.


Update:

I thought about 1 idea, which might be a good approach if it will work, I created a wrapper class for the resources:

Public Class Resources
    Public Shared ReadOnly m_Resources As New Resources
    Public Shared ReadOnly Property Resources() As Resources
        Get
            Return m_Resources
        End Get
    End Property

    Public ReadOnly Property MyResources(ByVal name As String) As Object
        Get
            Return My.Resources.ResourceManager.GetObject(name)
        End Get
    End Property
End Class

And then in my binding I try to access it like so:

<Setter Property="ImageSource"
Value="{Binding MyResources[Ok], Source={x:Static src:Resources.Resources}}"/>

But I still get the following message:

System.Windows.Data Error: 16 : Cannot get ‘MyResources’ value (type ‘Object’) from ” (type ‘Resources’). BindingExpression:Path=MyResources[Ok]; DataItem=’Resources’ (HashCode=59109011); target element is ‘Image’ (Name=’btnOk’); target property is ‘Source’ (type ‘ImageSource’) TargetParameterCountException:’System.Reflection.TargetParameterCountException: Parameter count mismatch.

BTW, I placed a test MessageBox in the MyResources Getter, and it seems the property is not accessed at all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:34:11+00:00Added an answer on May 12, 2026 at 1:34 pm

    The problem is that by default, the tool that generates code for the Resources.resx file is VbMyResourcesResXFileCodeGenerator (“Custom tool” property of the project item). This tool generates a Module in which the resource properties are internal (Friend), so the StaticExtension can’t access it. To solve that problem, you should change the custom tool for Resources.resx to PublicVbMyResourcesResXFileCodeGenerator, which will generate public members.

    Also, a VB module is roughly equivalent to a static (Shared) class, so there is no instance of Resources that could be used as the source of the binding, so you can’t specify a Path for the binding. You should set the binding source directly to the property you want :

    <Image Source="{Binding Source={x:Static my:Resources.MyImage},
        Converter={StaticResource MyBitmapToImageSourceConverter}}" />
    

    Note: there is another pair of tools available to generate the code for a resource file : ResXFileCodeGenerator and PublicResXFileCodeGenerator. These tools generate a class instead of a module.

    EDIT: The namespace mapping to use is the following :

    xmlns:myRes="clr-namespace:YourApplicationName.My.Resources"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to access the response headers from an HTTP result when
Is there any way to access the file object used by a CSV writer/reader
Is there any way to access the Windows Event Log from a java class.
Is there a way to access the Project object from a NAnt extension function,
Is there a way to access the DOM of the document in an iframe
Is there any way to access the <compilation /> tag in a web.config file?
Is there a way to access everything in the symbol table in Ruby? I
Using SQLite from .net, Is there a way to access the .dump command or
Is there some way to block access from a referrer using a .htaccess file
Is there a way I can access (for printout) a list of sub +

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.