如何使Resharper解析CustomBinding MarkupExtension的路径

Sim*_* D. 60 wpf resharper xaml visual-studio-2010 markup-extensions

我想创建一些扩展的Binding-Markup-Extension,它的行为就像普通的WPF-Binding一样,但做的更多(使用不同的默认值,可能会添加一些行为等).代码如下所示:

public class CustomBindingExtension : Binding
{
  .. some extra properties and maybe overrides ...
}
Run Code Online (Sandbox Code Playgroud)

这一切都很好,包括XAML-intellisense,除了我不能让Resharper正确解析我的Binding-Path.即:使用此代码我可以[Strg] +单击'CurrentText',Resharper让vs2010导航到定义CurrentText-Property的代码.

<UserControl x:Name="uc" ...>
  <TextBox Text="{Binding ViewModel.CurrentText, ElementName=uc}" />
</UserControl>
Run Code Online (Sandbox Code Playgroud)

但是使用我的绑定,它在运行时正常工作,我只是在悬停'CurrentText'时得到一个工具提示告诉我它是'MS.Internal.Design.Metadata.ReflectionTypeNode',并且没有通过[Strg] + Click导航.

<UserControl x:Name="uc" ...>
  <TextBox Text="{util:CustomBinding ViewModel.CurrentText, ElementName=uc}" />
</UserControl>
Run Code Online (Sandbox Code Playgroud)

我尝试了以下事项:

  • 从绑定派生
  • BindingDecoratorBase派生
  • 省略我的CustomBinding类的'Extension'后缀
  • 将Markup-Extension放在一个单独的程序集中
  • 使用ConstructorArgumentAttribute
  • 类型字符串的属性和Path-Property的类型PropertyPath
  • 我还查看了原始类Binding和BindingBase,但找不到我的代码的任何更多差异.任何想法应该有什么帮助?或者这只是对Binding-MarkupExtension的特殊处理,我无法获得自己的MarkupExtensions?

    更新2011年3月16日:也可能是错误或ReSharper的不足,Jetbrains的正在调查该问题:http://youtrack.jetbrains.net/issue/RSRP-230607

    更新10.12.2013:同时,该功能似乎正在工作(使用R#7.1.3,也许是早期版本),我实际上使用BindingDecoratorBase的方法,我非常喜欢它.也许它只有作用,如果你的MarkupExtension结束'Binding',但我的确如此,所以我很高兴.

    con*_*low 4

    实际上,这在当前版本的 R# 中是不可能的,并且不幸的是,仍然缺少即将发布的 R# 6.1 版本的功能。

    此功能需要大量基础设施更改,但它在我们的列表中,并且肯定会在 R# 7 中实现。似乎将引入[CustomBindingMarkup]and [BindingPath](对于path构造函数参数和属性)属性。Path

    对于给您带来的任何不便,我们深表歉意。

    • 我安装了 Resharper 7.1,但仍然遇到此问题。此修复是否已实施?是否有任何文档说明如何启用它? (2认同)