打开一个WPF DataGrid的背景图像和关闭? [英] Turning a WPF DataGrid background image on and off?
本文介绍了打开一个WPF DataGrid的背景图像和关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有空当,我想显示背景图像,该图像,一个DataGrid。当填充DataGrid祝的图像消失,并重新出现如果DataGrid再次清零。
这是可能的无论是通过XAML或者C#?
解决方案
如果(myDataGridView.Rows.Count == 0){
dataGrid.Background =新的ImageBrush(exampleImage.png);
}
其他 {
//它不是空
}
I have a DataGrid which, when empty, I wish to display a background image. When the DataGrid is populated I wish for the image to disappear, and reappear if the DataGrid is cleared again.
Is this possible either through XAML or C#?
解决方案
if(myDataGridView.Rows.Count == 0) {
dataGrid.Background = new ImageBrush("exampleImage.png");
}
else {
// it is not empty
}
这篇关于打开一个WPF DataGrid的背景图像和关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文