Display a default DataTemplate in a ContentControl when its content is null or empty?

后端 未结 3 851
逝去的感伤
逝去的感伤 2020-12-13 03:48

I would think this is possible, but the obvious way isn\'t working.

Currently, I\'m doing this:



        
3条回答
  •  天涯浪人
    2020-12-13 04:34

    You could return DBNull.Value as the FallbackValue of the Binding for the Content of the ContentControl, and create a DataTemplate for DBNull :

    
        
    
    
    ...
    
    
    

提交回复
热议问题