簡體   English   中英

XmlDataProvider用數據填充目標控件時如何在代碼背后知道

[英]How to know in codebehind when XmlDataProvider has filled target controll with data

我的問題的標題已經說過了。 如何檢查我的XmlDataProvider是否在后面的代碼中填充了DataGrid。 它已經可以工作了,但是我想檢查一下它何時完成,這樣我就可以在用戶能夠執行/查看任何操作之前在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";
}
  1. 使用LoadingRow事件: Dgrd.LoadingRow += DgrdParent_LoadingRow; ,此事件的美觀僅可見行觸發該事件,如果向下滾動或增大Window的大小,其余相關行將觸發此事件。

  2. 使用HasItems屬性。 僅當DataGrid完成其ItemsSource時,此屬性才變為True

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM