绑定到 xaml uwp 中的嵌套接口

Binding to nested Interfaces in xaml uwp

我有一个继承自另一个接口的接口。在我的代码中一切正常,我可以从两个界面看到一切。我正在尝试将接口绑定到 xaml(因为我将其注入到我的 ViewModel 中)但是 xaml 只能看到来自顶级接口的属性,而不是它继承自的接口。

这是我正在做的一个简单示例(请记住,这只是证明我遇到的问题的测试):

public interface IA
{
    void MethodA();

    private string _bindingPropA;
    public string BindingPropA
    {
       get { return _bindingPropA; }
       set { Set(ref _bindingPropA, value); }
    }

}

public interface IB : IA
{
    void MethodB();

    private string _bindingPropB;
    public string BindingPropB
    {
       get { return _bindingPropB; }
       set { Set(ref _bindingPropB, value); }
    }

}

public class TestService1 : IB
{
    public void MethodA()
    {
        Console.WriteLine("Method A");
    }

    public void MethodB()
    {
        Console.WriteLine("Method B");
    }
}

public class DPTest1
{
    public IB Injection;

    public DPTest1(IB injection)
    {
        Injection = injection;
    }
}

并实际测试它

DPTest1 TestInjection1 = new DPTest1(new TestService1());

//Can see methods from both interfaces just fine
TestInjection1.Injection.MethodA();
TestInjection1.Injection.MethodB();

//but if i bind it to xaml it only sees the properties in interface "IB"!

如果我尝试在 xaml 中绑定或 x:Bind 它,我只能在 "Interface IB"

中看到 "Method B"

xaml 是否真的无法绑定到嵌套接口,我必须将 TestService 编码到我的 class 而不是将其注入接口???

抱歉,误报... 我所要做的就是清理和重建,Xaml 编辑器开始看到所有继承的接口。现在一切正常!