嵌套 WPF 数据网格
我有一个 DataGrid(来自工具包),我想在 DataGrid.RowDetailsTemplate 中嵌套另一个 DataGrid。 诀窍是我想从主网格中的一个表中带回数据,然后根据行选择从不同的表中获取附加详细信息,并将其显示在详细信息模板的 DataGrid 中。
这在 2 个独立的 DataGrid 中很容易做到,但我在让它与嵌套版本一起使用时遇到了困难。
这可能吗? 如果是这样,有人可以指出我正确的方向吗? 我应该注意我正在使用 LinqToSql 类来填充数据。
感谢您的考虑。 -乔尔
I have a DataGrid (from the toolkit) and I want to nest another DataGrid in the DataGrid.RowDetailsTemplate. The trick is I want to bring back the data from one table in the main grid and then based on row selection go and get additonal detail from a different table and show it in the DataGrid in the detail template.
This is easy enough to do in 2 seperate DataGrids but I am having trouble getting it to work with the nested version.
Is this even possible?
If so, could someone point me in the right direction.
I should note I am using LinqToSql clases to populate the data.
Thanks for your consideration.
-Joel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 LinqToSQL,则可以使用关联轻松完成此操作。 在我的实践中,我创建了两个表:
GuyTable
UniqueID
我创建了从 GuyTable.UniqueID 到 GuyActionsTable.GuyID 的一对多关系,称为“GuyActions”,
然后像这样绑定我的 DataGrid。 请原谅我手动执行此操作时出现的任何错误:
If you are using LinqToSQL you can easily do this using an association. In my practice I have created two tables:
GuyTable
GuyActionsTable
I created a one-to-many relationship from GuyTable.UniqueID to GuyActionsTable.GuyID called "GuyActions"
I then bind my DataGrid like this. Excuse any errors as I am doing this by hand: