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

廉价感情. 提交于 2019-12-12 19:53:56

问题


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:


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



来源:https://stackoverflow.com/questions/36941300/how-to-provide-intellisense-with-the-datacontext-type-in-a-resharper-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!