I want to create an extended Binding-Markup-Extension that behaves like regular WPF-Binding, but does some things more (use different defaults, maybe add some behavior, etc.). The code is as follows:
public class CustomBindingExtension : Binding { .. some extra properties and maybe overrides ... }
Everything works fine, including XAML-intellisense, except that I just can't get Resharper to correctly resolve my binding. Ie: using this code, I can [Strg] + click "CurrentText", and Resharper allows vs2010 to jump to the code defining CurrentText-Property.
<UserControl x:Name="uc" ...> <TextBox Text="{Binding ViewModel.CurrentText, ElementName=uc}" /> </UserControl>
But using the my binding, which works correctly at runtime, I just get a hint when "CurrentText" hangs, telling me that it is "MS.Internal.Design.Metadata.ReflectionTypeNode" and there is no navigation on [Strg] + Click.
<UserControl x:Name="uc" ...> <TextBox Text="{util:CustomBinding ViewModel.CurrentText, ElementName=uc}" /> </UserControl>
I have tried the following things:
Derive from binding Derive
BindingDecoratorBase Leave the suffix 'Extension' for my CustomBinding class add the markup extension to a separate assembly Use constructorArgumentAttribute String property and type PropertyPath for Path-Property
I also looked at the source classes of Binding and BindingBase, but could not find any more differences from my code. Any ideas what should help here? Or is it just a special approach to Binding-MarkupExtension that I can in no way get for my own MarkupExtensions?
Update 16.03.2011: There may also be a bug or shortcoming of Resharper, Jetbrains is investigating the problem: http://youtrack.jetbrains.net/issue/RSRP-230607
Update 10.12.2013: Meanwhile, the function seems to work (with R # 7.1.3, maybe earlier versions), I actually use the approach with BindingDecoratorBase, and I really like it. Maybe it only works if your MarkupExtension ends with "Binding", but mine does, so I'm happy.