[英]How to know in codebehind when XmlDataProvider has filled target controll with data
The title of my question says it already. 我的问题的标题已经说过了。 How can I check if my XmlDataProvider has filled my DataGrid in code behind.
如何检查我的XmlDataProvider是否在后面的代码中填充了DataGrid。 It already works, but I want to check when it is finished so I can style the cells in my DataGrid(ForeGround, Background, TextWeight) before the user is able to do/see anything:
它已经可以工作了,但是我想检查一下它何时完成,这样我就可以在用户能够执行/查看任何操作之前在DataGrid(ForeGround,Background,TextWeight)中设置单元格的样式:
public ExcelWindow(string filePath)
{
InitializeComponent();
_filePath = filePath;
Dispatcher.beginInvoke((Action)(() =>
{
LoadScreenSettings();
}));
LoadXml();
CellLayoutHandler = new CellLayoutHandler(DataGridXml, _FilePath);
}
private void LoadXml()
{
XmlDataProvider dataProvider = xmlDataProvider;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(_FilePath);
dataProvider.Document = xmlDoc;
dataProvider.XPath = "Data/Row";
}
Use LoadingRow
event : Dgrd.LoadingRow += DgrdParent_LoadingRow;
使用
LoadingRow
事件: Dgrd.LoadingRow += DgrdParent_LoadingRow;
, beauty of this event is only visible Rows fire this event, if you scroll down or increase the size of the Window
, remaining relevant rows will fire this event. ,此事件的美观仅可见行触发该事件,如果向下滚动或增大
Window
的大小,其余相关行将触发此事件。
Use HasItems
property. 使用
HasItems
属性。 This property becomes True
only when DataGrid
is finished with its ItemsSource
. 仅当
DataGrid
完成其ItemsSource
时,此属性才变为True
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.