C# 数据网格中的问题
我应该怎么做才能解决这个错误。这肯定是一个编译时错误;因此,我假设它在构建项目时抛出了错误C# 数据网格中的问题,c#,wpf,linq-to-sql,wpfdatagrid,C#,Wpf,Linq To Sql,Wpfdatagrid,我应该怎么做才能解决这个错误。这肯定是一个编译时错误;因此,我假设它在构建项目时抛出了错误 它没有数据源属性,请改用项目资源,您不应该像WinForms那样通过数据源属性直接将数据表连接到数据网格。使用数据绑定!:) 您可以在XAML中设置数据绑定 System.Windows.Controls.DataGrid' does not contain a definition for 'DataSource' and no extension method 'DataSource' accept
它没有
数据源
属性,请改用项目资源
,您不应该像WinForms那样通过数据源属性直接将数据表连接到数据网格。使用数据绑定!:)
您可以在XAML中设置数据绑定
System.Windows.Controls.DataGrid' does not contain a definition for 'DataSource'
and no extension method 'DataSource' accepting a first argument of
type 'System.Windows.Controls.DataGrid' could be
found (are you missing a using directive or an assembly reference?)"**.
您应该认真阅读WPF中的for和,因为这些技术将在未来的开发中为您提供很多帮助。这比我一开始想象的要容易得多——而且在你学会了第一步之后,速度很快
有很多关于datagrid数据绑定的好教程,我曾经在和中找到过一个。您真的不想在MSDN/docs中查找datagrid的属性吗?
System.Windows.Controls.DataGrid' does not contain a definition for 'DataSource'
and no extension method 'DataSource' accepting a first argument of
type 'System.Windows.Controls.DataGrid' could be
found (are you missing a using directive or an assembly reference?)"**.
<DataGrid ItemsSource="{Binding Customers}" />
dataGrid1.ItemsSource = Customer.GetSampleCustomerList();