title: My.Resources in WPF XAML?
body: <p>Is there a way to access My.Resources thru Xaml?</p>
  
  <p>Like this</p>
  
  <pre><code>&lt;Image Source="{Binding MyImage,
      Source={x:Static my:Resources},
      Converter={StaticResource MyBitmapToImageSourceConverter}}" /&gt;
  </code></pre>
  
  <p>This is the error I get:
  <strong>\Application.xaml(122,36): error MC3029: 'my:Resources' member is not valid because it does not have a qualifying type name.</strong></p>
  
  <p>The above doesn't work of course.</p>
  
  <p>NOTE: The converter is for illustration only.</p>
  
  <hr>
  
  <h2>Update:</h2>
  
  <p>I thought about 1 idea, which might be a good approach if it will work, I created a wrapper class for the resources:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>And then in my binding I try to access it like so:</p>
  
  <pre><code>&lt;Setter Property="ImageSource"
  Value="{Binding MyResources[Ok], Source={x:Static src:Resources.Resources}}"/&gt;
  </code></pre>
  
  <p>But I still get the following message:</p>
  
  <p><strong>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.</strong></p>
  
  <p>BTW, I placed a test MessageBox in the MyResources Getter, and it seems the property is not accessed at all.</p>