silverlight datagrid 中的层次结构数据
我正在尝试创建一个数据网格,其中第一列包含“+”号,下一列包含数据。当用户单击“+”号时,将从当前行获取数据,并且来自不同表的相应层次结构数据将显示在当前行下方的新网格中。我尝试在线搜索但找不到任何示例。
请建议我如何检查这一点。
假设网格包含
- col1 Col2.... Col50
- col1 Col2.... Col50
当用户单击“+”号时。
它应该读取 col1, Col2, Col3,Col4
然后进行 db 调用并根据上述值获取数据。
生成的网格应该是
- col1 col2.... Col50 NestedCol1 NestedCol2... NestedCol20 NestedCol1 NestedCol2... NestedCol20 。 。 。 。 。
- col1 col2... Col50
谢谢,纳文
I am trying to create a Datagrid where the first column contains '+' sign and next columns contain the data. When the user clicks the '+' sign the data is taken from the current row and the corresponding hierarchial data from different table is displayed in the new grid just below the current row. I tried searching online but could not find any example.
Please suggest me how to check this.
Lets say the grid contains
- col1 Col2.... Col50
- col1 Col2.... Col50
When the user clicks the '+' sign.
it should read col1, Col2, Col3,Col4
Then make a db call and get the data based on the above values.
the resulting grid should be
- col1 col2.... Col50
NestedCol1 NestedCol2... NestedCol20
NestedCol1 NestedCol2... NestedCol20
.
.
.
.
. - col1 col2... Col50
Thanks, Naveen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您必须在 DataGrid 中定义一个新的 RowDetailsTemplate。在资源中定义一个新的 DataTemplate,其中有一个包含两行的网格:
“+”按钮将控制第二行的可见性以及相应行的数据加载。
我希望这会让你从正确的方向开始编辑
:
通过放入某种集合中,分层数据必须成为第一行中的数据的一部分,
这样您就可以将第二行中的控件的 ItemsSource 设置为该集合。
Looks like you'll have to define a new RowDetailsTemplate in the DataGrid. In the Resources define a new DataTemplate that has a grid in it with two rows:
The '+" button would control the visibility of the second row and the loading of the data for the appropriate row.
I hope this will get you started in the right direction.
Edit:
The hierarchical data will have to be part of the data in the first row by placing into a collection of some sort.
This way you can set the ItemsSource for the control in the second row to the collection.