How-to define Empty DataTemplate for the ItemsControl based controls like ListView or DataGrid

后端 未结 3 1345
刺人心
刺人心 2021-02-13 10:31

ASP.NET controls like ListView allows providing a custom template by setting the ListView.EmptyDataTemplate property, this template will be rendered in case of empty data source

3条回答
  •  被撕碎了的回忆
    2021-02-13 10:48

    You can use set the Template property based on a DataTrigger

    For example,

    In Resources:

    
         
    
    

    Control itself:

    
        
            
        
    
    

    There might be an simplier way of doing the binding, but I don't have a compiler on me right now to figure out what it would be :)

提交回复
热议问题