How to make Resharper resolve path for CustomBinding MarkupExtension

前端 未结 3 1317
南方客
南方客 2021-02-06 20:32

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,

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-06 20:51

    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#

    
    

提交回复
热议问题