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

前端 未结 6 1482
时光取名叫无心
时光取名叫无心 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:40

    You have another option. Set a Key on your DataTemplate and reference that key in the ItemTemplate. Like this:

    
        
    

    then reference the template by key where you want to use it, like this:

    
    
    

    Rendering

提交回复
热议问题