【问题标题】:Silverlight: Populate Nested Datagrid when the parent datagrid row is selectedSilverlight:选择父数据网格行时填充嵌套数据网格
【发布时间】:2011-07-07 22:39:29
【问题描述】:

我在将数据加载到嵌套数据网格时遇到问题。当用户单击父数据网格中的一行时,将检索 id 并基于该嵌套数据网格加载。

在 rowDetailsVisibilityChanged 事件中。

        DataGrid nestedDataGrid = e.DetailsElement as DataGrid;

        SampleObj data= e.Row.DataContext as SampleObj ;

        var client = new MyService.SampleServiceClient();
        client.GetReportArchiveDataCompleted += GetSampleDataCompleted;
        client.GetSampleDataAsync(data);

如何在 Asyn 完成事件中添加这一行,因为我无法在完成事件中获取嵌套的 Datagrid。

IEnumerable dataList= e.Result; nestedDataGrid.ItemSource = 数据列表

【问题讨论】:

    标签: c# silverlight datagrid asynchronous


    【解决方案1】:

    改用匿名函数....

    client.GetReportArchiveDataCompleted += 
      delegate(object sender1, GetReportArchiveDataCompletedArgs e1) {
        nestedDataGrid.ItemSource=(IEnumerable)e1.Result;
      };
    

    显然将委托更改为正确的签名(与您的 GetSampleDataCompleted 相同。

    【讨论】:

      猜你喜欢
      • 2011-11-18
      • 1970-01-01
      • 1970-01-01
      • 2010-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-08
      • 1970-01-01
      相关资源
      最近更新 更多