Edw*_*uay 7 data-binding wpf datagrid telerik wpftoolkit
在一个Telerik控件中,我能够DataTable直接绑定到ItemSource,但是当我切换到Codeplex时WPFToolkit Datagrid:
<dg:DataGrid Name="theGrid"/>
---
theGrid.ItemsSource = dt;
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Cannot implicitly convert type 'System.Data.DataTable' to 'System.Collections.IEnumerable'.
Run Code Online (Sandbox Code Playgroud)
我该如何绑定DataTable到WPFToolkit DataGrid?
vig*_*ity 32
我发现最简单的方法是:
myDataGrid.ItemsSource = myDataTable.DefaultView;
Run Code Online (Sandbox Code Playgroud)
因为DefaultView实现了IEnumerable
| 归档时间: |
|
| 查看次数: |
19123 次 |
| 最近记录: |