WPF databinding to interface and not actual object - casting possible?

前端 未结 6 1476
时光取名叫无心
时光取名叫无心 2020-11-27 05:27

Say I have an interface like this:

public interface ISomeInterface
{
...
}

I also have a couple of classes implementing this interface;

6条回答
  •  春和景丽
    2020-11-27 05:39

    In order to bind to explicit implemented interface members, all you need to do is to use the parentheses. For example:

    implicit:

    {Binding Path=MyValue}
    

    explicit:

    {Binding Path=(mynamespacealias:IMyInterface.MyValue)}
    

提交回复
热议问题