多级标题 GridView WPF
我需要将列表视图视图设置为具有像这样的复杂标头的网格视图(基于我创建的 3 维对象列表):
| ---------- LEVEL 0 ------------ |
| -- Level 1a -- | -- Level 1b -- |
| Lvl A | Lvl B | Lvl A | Lvl B |
编辑:这更像是我的对象模型,
public class Measures
{
public string Caption { get; set; }
public List<Threshold> ThresholdList { get; set; }
}
public class Threshold
{
public string Caption { get; set; }
public double Value1 { get; set; }
public double Value2 { get; set; }
public double Value3 { get; set; }
public double Value4 { get; set; }
}
我必须绑定 Measures
(这是我的级别 0),然后是 Threshold
的动态列表(级别 1a...),并且对于每个阈值显示值 1 到 4(如果它们是!= 0)
I need to set the listview view to a gridview that have a complex header like this (based on a 3 dimensional object list i created):
| ---------- LEVEL 0 ------------ |
| -- Level 1a -- | -- Level 1b -- |
| Lvl A | Lvl B | Lvl A | Lvl B |
EDIT: This is more ore less my object model
public class Measures
{
public string Caption { get; set; }
public List<Threshold> ThresholdList { get; set; }
}
public class Threshold
{
public string Caption { get; set; }
public double Value1 { get; set; }
public double Value2 { get; set; }
public double Value3 { get; set; }
public double Value4 { get; set; }
}
i've to bind a dynamic list of Measures
(this is my level 0), then a dynamic list of Threshold
(level 1a...) and for each threshold display values1 to 4 if they are != 0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
像这样的事情怎么样:
您可能需要将 Value1、Value2 属性转换为集合,以便动态显示非零属性并使用我用来显示阈值的相同 ListBox/StackPanel 方法。
这给出了输出:
为了完成这篇文章,这里是我使用的代码:
How about something like this:
You might need to convert the Value1, Value2 properties into a collection in order to dynamically display the non-zero ones and use the same ListBox/StackPanel approach that I used to display the thresholds.
This gives the output:
And just to complete the post, here is the code I used:
Level 0 是ListView吗?级别 1A 和级别 1b 是您想要在级别 0 列表视图内的两个不同模板化列中的 Gridview?那么级别 A 和级别 b 是级别 1a 和级别 1b 中另外 2 个模板化列内的另外两个网格视图吗?
您也许能够将此嵌套 GridView 使用的相同概念转换为 WPF
http://forums.asp。 net/t/1071521.aspx
我自己没有在 wpf 中尝试过,但 gridviews 似乎是类似构建的。
只需使用面板而不是 Div,就可以减少因担心客户端/服务器端调用而带来的头痛。
此外,数据集比列表工作得更好。
这是一些关于我之前如何设置嵌套数据集的伪代码
Level 0 Is a ListView? Level 1A and level 1b are Gridviews that you want inside two different templated columns inside the level 0 List view? Then level A and level b are two more grid views inside 2 more templated columns in level 1a and level 1b?
You might be able to convert the same concept this nested GridView uses into WPF
http://forums.asp.net/t/1071521.aspx
I haven't tried it myself in wpf, but gridviews appeared to be built similarly.
Just use panels instead of Divs, and less head aches with having to wory about client/serverside calls.
Also Datasets work nicer then lists.
Here is some psuedo code on how I've set up Nested Datasets before
你有没有想过它应该如何表现——你的标题?
制作一个看起来像您建议的那样的标题很容易 - 您可以通过编程方式使用一些网格构建它 - 但这只是标题。您是否还应该能够像通常使用列表视图标题一样调整它的大小?
也许您正在寻找类似 TreeListView 的东西?
http://www.codeproject.com/KB/WPF/TreeListView.aspx
我认为这就是我所追求的显示多维数据的方式——它很容易理解和使用,而自定义列表视图很难实现正确的行为。
Have you thought about how it should behave - your header that is?
It is easy enough to make a header that looks like the one you suggest - you could build it with some grids programatically - but that is just the header. Should you also be able to resize it like you normally can with a listview header?
Maybe you looking for something like a TreeListView?
http://www.codeproject.com/KB/WPF/TreeListView.aspx
I think that is what I would go after to display multidimentional data - it is easy to understand and use, where a custom listview can be hard to implement to behave right.