c# - 如何使用带有内部列表的列表集合表示 wpf 中的数据
问题描述
当每个属性都包含他的名称和值列表时,我如何表示我的属性集合(列表)?内部列表(值)通常具有不同的长度。我正在使用 wpf。我试图使用 DataGrid 但无法正确绑定集合
解决方案
您可以将 ItemsControl 与 ItemTemplate 属性设置为 DataTemplate 与另一个 ItemsControl 一起使用,如下所示:
> <ItemsControl ItemsSource="{Binding OuterList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
<ItemsControl ItemsSource="{Binding InnerList}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
推荐阅读
- varnish - VCL中的符号“~”是什么意思?
- jira - JIRA 中的用户状态依赖
- primefaces - Primeface 确认对话框可访问性
- python-3.x - 输入大小(输入深度)必须可通过形状推断访问,但在尝试将 tf.expand_dims 轴设置为 0 时看到值 None 错误
- ruby - 散列数组到散列的散列
- openlayers - 如何在地图单击事件上获取要素子几何样式坐标
- apache-spark - 无法使用 Spark 合并小型 ORC 文件
- sql-server - SQL Server 2017 上的 Team Foundation Server 2012 支持问题
- ios - 使用谓词过滤数组时应用程序崩溃 - IOS -Swift 4
- odoo - 从销售订单行中的移动行分配的数量