Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make Resharper resolve path for CustomBinding MarkupExtension
    primarykey
    data
    text
    <p>I want to create some extended Binding-Markup-Extension, which behaves just like a normal WPF-Binding but does some things more (use different defaults, maybe add some behavior, etc.). Code looks like this:</p> <pre><code>public class CustomBindingExtension : Binding { .. some extra properties and maybe overrides ... } </code></pre> <p>It all works fine including XAML-intellisense, except I just can't make Resharper resolve my Binding-Path correctly. I.e.: using this code I can [Strg]+Click on 'CurrentText' and Resharper lets vs2010 navigate to the code defining the CurrentText-Property.</p> <pre><code>&lt;UserControl x:Name="uc" ...&gt; &lt;TextBox Text="{Binding ViewModel.CurrentText, ElementName=uc}" /&gt; &lt;/UserControl&gt; </code></pre> <p>But using <strong>my</strong> binding, which works correctly at runtime, I just get a Tooltip when hovering 'CurrentText' telling me it is some 'MS.Internal.Design.Metadata.ReflectionTypeNode', and no navigation via [Strg]+Click.</p> <pre><code>&lt;UserControl x:Name="uc" ...&gt; &lt;TextBox Text="{util:CustomBinding ViewModel.CurrentText, ElementName=uc}" /&gt; &lt;/UserControl&gt; </code></pre> <p>I tried the following things: <li>Derive from Binding</li> <li>Derive from <a href="http://www.hardcodet.net/2008/04/wpf-custom-binding-class" rel="nofollow noreferrer">BindingDecoratorBase</a></li> <li>Leave out the 'Extension' suffix for my CustomBinding-class</li> <li>put the Markup-Extension in a separate assembly</li> <li>Use ConstructorArgumentAttribute</li> <li>Property of type string and type PropertyPath for the Path-Property</li></p> <p>I also looked at the original classes Binding and BindingBase, but could not find any more difference to my code. Any ideas what should help here? Or is this just a special treatment of the Binding-MarkupExtension which I can in no way get for my own MarkupExtensions?</p> <p>Update 16.03.2011: Might also be bug or deficiency of Resharper, Jetbrains is investigating the issue: <a href="http://youtrack.jetbrains.net/issue/RSRP-230607" rel="nofollow noreferrer">http://youtrack.jetbrains.net/issue/RSRP-230607</a></p> <p>Update 10.12.2013: Meanwhile, the feature seems to be working (with R# 7.1.3, maybe also earlier versions), I actually use the approach with the BindingDecoratorBase and I like it a lot. Maybe it only works, if your MarkupExtension ends on 'Binding', but mine does, so I am happy.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload