开发者

Creating a WPF Hybrid Control (TreeView + DataGrid = DataTreeGrid)

开发者 https://www.devze.com 2023-02-20 21:21 出处:网络
I need to create a TreeView that hold synchronized data, like a DataGrid. To clarify, take a look at this image:

I need to create a TreeView that hold synchronized data, like a DataGrid.

To clarify, take a look at this image:

Creating a WPF Hybrid Control (TreeView + DataGrid = DataTreeGrid)

So, I have a TreeView at left side with columns at right side.

The data will come from objects like this:

public NodeData Parent;
public List<NodeData> Children;

public String Label;

public Boolean DataA;
public Boolean开发者_Python百科 DataB;
public Boolean DataC;
public Boolean DataX;
public Boolean DataY;
public Boolean DataZ;

How can I create this?


This blog entry from Marius Rochon may help you.


This is the best control I have found for presenting data like this. It does not require an interface/basclass on the viemodels and uses HierarchicalDataTemplate


To me this looks like a regular DataGrid with a few Groupings set on it

So in your case you would create a DataGrid that groups on Root, Node #, Node 2nd Number, and Node 3rd Number.

Also flatten your list of NodeData so it is a single list with each item containing properties for Root, NodeLevel1, NodeLevel2, and NodeLevel3

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号