Show “No record found” message on a WPF DataGrid when it's empty

后端 未结 4 1675
陌清茗
陌清茗 2020-12-18 22:13

If there is no record available, I want to add a TextBlock on data grid, below the header, showing the message \"No Record Found.\"

Consider the attac

4条回答
  •  春和景丽
    2020-12-18 22:59

    I find that it is easy to center a text block over the grid and set its visibility based on the number of rows. I am usually using MVVM and will bind the visibility to a View Model property:

    
        
            
               .
               .
               .
            
        
        
    
    

提交回复
热议问题