I have a WPF window and am using the MVVM pattern. I set the view model as a resource for the window as follows...
...other stuff removed for clarity...
<mvvm:DhrTemplatesViewModel x:Key="viewmodel" />
I want to set the window's data context to use the resource, and found that the following XAML works...
The problem is that I can only do this by typing the XAML manually, Visual Studio doesn't show the resource anywhere. I can go to the window's properties and click the little icon next to the DataContext property, click the "Apply resource" option, but it doesn't show "viewmodel" as a resource, static or dynamic. If I enter the XAML manually and then open the "Apply resource" pop-up window, it has the "viewmodel" underlined as an error, and hovering over it shows a tooltip "cannot resolve resource reference"
However, when I run the application, it works fine, so the resource *is* being resolved at run time.
I would really like to be able to do this through the VS property editor, as I find that more convenient than typing the XAML by hand. I'm also bothered by the fact that VS can't resolve it. This look like a bug to me.