How to provide intellisense with the datacontext type in a resharper plugin?

371 views Asked by At

When writing a wpf prism app, I use the ViewModelLocator to automatically create the datacontext when needed. While this works great, there's no intellisense help unless I add a designtime datacontext (d:DataContext="{d:DesignInstance viewModels:MyViewModel}"), but that somewhat defeats the purpose of automatically discovering and connecting the viewmodel.

I image something like this: a resharper plugin that looks for ViewModelLocator.AutowireViewModel="True" in the xaml, fetches the class name, derives the viewmodel type and then tells intellisense to use this type as datacontext.

Question: is it possible for a resharper plugin to tell intellisense what is the type of the datacontext without the designtime datacontext?

Ancillary question: can you give a complete resharper sdk beginner a hint on how to accomplish this?

1

There are 1 answers

0
citizenmatt On

Unfortunately, that part of ReSharper is not extensible - it will only work with data set in the file. There is an issue suggesting extending by use of annotations, which is a nice idea - you can vote on it, add details and track: RSRP-385725