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

后端 未结 3 857
逝去的感伤
逝去的感伤 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:40

    Since I stumbled upon this question and had the same problem today, I wanted to contribute another way how I solved the problem. Since I did not like to add another style trigger I used the property TargetNullValue which seems to be a bit more readable than the accepted solution (which works nevertheless):

        
          
            
              
                
                  EMPTY!
                
              
            
          
        
    

提交回复
热议问题