How to make Resharper resolve path for CustomBinding MarkupExtension
Actually it's not possible in current versions of R# and, unfortunately, still be missing feature of upcoming R# 6.1 release.
This feature requires a lot of infrastructure changes, but it's on our list and definitely will be implemented in R# 7. Seems like [CustomBindingMarkup]
and [BindingPath]
(for path
constructor parameter and the Path
property) attributes will be introduced.
We really apologize for any inconvenience.
You should access your custom Markup-Extension, using the correct namespace:
<UserControl x:Name="uc" ...xmlns:ext="clr-ns:YourProjectNamespace"> <TextBox Text="{ext:CustomBinding ViewModel.CurrentText, ElementName=uc}" /></UserControl>
Here is a nice article about creating custom Markup-Extensions.
One way to fool R# is to name it Binding:
public class Binding : MarkupExtension{ public Binding() { } public Binding(string path) { Path = path; } public string Path { get; set; } public override object ProvideValue(IServiceProvider serviceProvider) { return 5; }}
Then it works the same as standard binding with R#
<TextBlock Text="{custom:Binding SomeProp}" />