DataGrid中的列表框 [英] Listbox within a DataGrid

查看:60
本文介绍了DataGrid中的列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All

有人可以指出我在DataGrid中有一个Listbox的正确方向吗?



我有一个数据网格通过sqlite查询返回多行。在每一行中,我需要一个列表框,它应返回与该行关联的多个项目。我将数据网格中父表的引用ID作为列返回,但似乎无法找到一个解决方案来返回列表框中的子记录。



我想我需要通过DataGridTemplateColumn或其他东西来做这件事。



问题1:如何在xaml中构建它

问题2:我将如何遍历sql以在代码隐藏或任何其他方法中显示带有子列表框项的数据网格行



图形表示我需要的东西



注意:每个ListBox也需要可编辑

Hello All
Could someone please point me in the right direction regarding having a Listbox within a DataGrid?

I have a datagrid returning multiple rows via sqlite query. Within each row I need a listbox which should return multiple items associated with that row. I’m returning the reference id from the parent table in the datagrid as a column but can’t seem to find a solution to return the child records in the listbox.

I’m thinking I need to do this via a "DataGridTemplateColumn" or something.

Question 1: How would this be structured in the xaml
Question 2: How would I iterate through sql to present datagrid rows with child listbox items in code behind or any other method

Graphical Representation of what I need

NOTE: Each ListBox needs to be editable as well

推荐答案

访问这里...





http://social.msdn.microsoft.co m /论坛/ vstudio / zh-CN / 5ed06af6-b887-4175-a65e-753271373fcb / databinding-a-listbox-in-datagrid?forum = wpf [ ^ ]









http://stackoverflow.com/questions/18959304/wpf-listbox-selectionchanged-mvvm [ ^ ]
visit here...


http://social.msdn.microsoft.com/Forums/vstudio/en-US/5ed06af6-b887-4175-a65e-753271373fcb/databinding-a-listbox-in-datagrid?forum=wpf[^]

or


http://stackoverflow.com/questions/18959304/wpf-listbox-selectionchanged-mvvm[^]


我觉得这个对你很有帮助:

================================== =======



http://stackoverflow.com/questions/15333893/failed-to-read-nested-customized-listbox-val ue-in-datagrid-wpf [ ^ ]
I Think This one Helpful to you :
=========================================

http://stackoverflow.com/questions/15333893/failed-to-read-nested-customized-listbox-value-in-datagrid-wpf[^]


这篇关于DataGrid中的列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆