wpf中使用MVVM的复杂TreeView [英] Complex TreeView in wpf using MVVM

查看:140
本文介绍了wpf中使用MVVM的复杂TreeView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发一个应用程序,其中必须在左侧显示treeview

Hi ,

I am working on an application, in which i have to show treeview in left side

Customers (Root node)
.....Customer1
	...Trip1
	    ...Situation
		Situation1
		Situation2
	    ...Visit
		Visit1
		Visit2
	    ...Activity
		Activity1
		Activity2	
	...Trip2
	    ...Situation
		Situation1
		Situation2
	    ...Visit
		Visit1
		Visit2
	    ...Activity
		Activity1
		Activity2
.....Customer2
	...Trip1
	    ...Situation
		Situation1
		Situation2
	    ...Visit
		Visit1
		Visit2
	    ...Activity
		Activity1
		Activity2	
	...Trip2
	    ...Situation
		Situation1
		Situation2
	    ...Visit
		Visit1
		Visit2
	    ...Activity
		Activity1
		Activity2


这个树形视图不是静态的..它本质上是动态的..
可以添加,删除,更新任何级别的任何计时器节点..
我用表(Customer,Trip,Situation,Activity,Visit)创建了一个数据集.
与表格之间的关系...
并将该数据集绑定到TreeView..
在选择节点时,应出现对应的treenode的右侧xaml..

请帮助我..我已经在网上搜索了很多天..使用可观察的收集方式或一些经典的方式来解释它的任何地方..

请让我详细了解执行此操作最简便的方法

1. Treeview ..动态性质
2.我想为hastable中的每个节点保存xml的usercontrol或viewuser控件(显示在右侧). 哈希表应具有键(Treenode的ID),而值应具有xaml的usercontrol或viewuser控件(显示在右侧)

非常感谢..等待答复


This treeview is not static..it is very dynamic in nature..and
any timer node at any level can be added, deleted, updated..
I have created a dataset with tables (Customer,Trip,Situation,Activity,Visit)
with relations among tables...
and bound that dataset to TreeView..
on selection of nodes, right side xaml for corresponding treenode should appear..

please help me..i have already spent so many days by searching on net..everywhere it has been explained by using observable collection way or some classic way..

please let me know in detail what is easiest and simplest way for doing this

1. Treeview ..dynamic nature
2. I want to save xaml of usercontrol or viewuser control (to display on right side) for each and every node in hastable..
Hashtable should have key (Treenode''s id) and Value should have xaml of usercontrol or viewuser control (to display on right side)

Thanks a lot in advance..Waiting for reply

推荐答案

treeView本质上是动态的,使用 observable集合是最好的选择,当从VM更新可观察的集合时,树会自动更新.但是您尝试的解决方案可能会降低性能,请尝试使用可观察的集合更新树视图.如果您能提供更多的信息,也许我们可以解决一些问题,那么我将无法确切地知道您想做什么.
The treeView is dynamic in nature and using the observable collection is the best option,as the observable collection is updated from the VM then the tree is automatically updated.But the solution you are trying may be a bit performance degrading try updating the tree view using the observable collection.It''ll be easier.As for your second clause i could not get the idea of what you wanted to do exactly if you could some more information may be we can work out some thing.


这篇关于wpf中使用MVVM的复杂TreeView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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