Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要从一个 wpf 工具包数据网格中选择一组行,并希望将其添加到另一个 wpf 工具包数据网格中。我使用的代码如下:
foreach(DataRowView row in MyFirstDataGrid.SelectedItems) { MySecondDataGrid.Items.Add(row); }
但这里的问题是,它只是在第二个数据网格中添加了空行,没有任何内容......有人可以帮我解决这个问题吗????
谢谢和问候,苏巴。
网格是绑定的吗?你能把它添加到第二个网格的项目源中吗?
我认为即使您定义了相同的列,如果您将行添加到第二个数据网格,它也不会起作用。相反,如果两个网格都有相同类型的 ItemsSource,则将其添加到第二个网格的 itemsSource。如果它是 ObservableCollection,应该可以工作。