This is a migrated thread and some comments may be shown as answers.

Is possible to hide parent node?

3 Answers 250 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 28 Aug 2012, 05:07 PM
If the data like below:

RootNode1
- Level1
-- Level2
--- Level3

and I would like to provide a check box to hide Level1 or Level2
Ex: Hide Level1 the output should be 

RootNode1
- Level2
-- Level3  

Ex: Hide Level2 the output should be 

RootNode1
- Level1
-- Level3

Ex: Hide both Level1 and Level2 the output should be 

RootNode1
- Level3


Is possible to do it with RadTreeView?

BTW: we are using RadControl for WPF 2012.2.0725, and the each level in the tree is an ObservableCollection list, and we use converter to convert each list into ListCollectionView to handle sorting and filtering ( http://www.zagstudio.com/blog/434#.UDz-sNaPXng ).


Thanks.

 


3 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 28 Aug 2012, 06:00 PM
To be clarify, here is what I need to achieve:

Ex: file data:
c:\test\folder1\myData1.txt  <-- defined two nodes: dog (nodeType: animal), banana (nodeType: fruit)
c:\test\folder2\myData2.txt  <-- defined three nodes: cat (nodeType: animal),  apple (nodeType: fruit), boat (nodeType: vehicle) 

and there are two check boxes:
1. Hide directory and filename
2. Hide node type

Case1: show everything

test 
- folder1
-- myData1.txt
--- animal
---- dog
--- fruit
---- banana  
- folder2
-- myData2.txt
--- animal
---- cat
--- fruit
---- apple
--- vehicle 
---- boat  

Case2: Hide directory and filename 

animal
- dog
fruit
banana  
animal
- cat
fruit
- apple
vehicle 
boat   

The output above does not user friendly... we would like to not only hide directory/filename but also merge the same node types like below:

animal
- dog
- cat
fruit
banana  
- apple
vehicle 
boat    

Case3: Hide node type 

test 

- folder1
-- myData1.txt
--- dog
--- banana  
- folder2
-- myData2.txt
--- cat
--- apple
--- boat  

Case4: Hide "directory and filename" AND "node type"
 
dog
banana  
cat
apple
boat   


Note: the actually data structure UI received likes the case 1 above, and there is a filewatcher monitoring files and modifying the data dynamically, the UI should reflect the data source change automatically, which mean I cannot create a new list when need to display the Case2, 3 and 4, because a new list won't reflect the source changes.




 
0
Accepted
Hristo
Telerik team
answered on 30 Aug 2012, 07:06 AM
Hi,

RadTreeView is design to show all the data in its collection. Thus said you should modify your source collection if you want to modify the tree view. If you want to remove some node from the tree view and preserve its children you should remove that node with all its children and insert the children again in the place of the removed item. This action will cause full rebuild of the visual containers displaying your data objects.

Regards,
Hristo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Chris
Top achievements
Rank 1
answered on 30 Aug 2012, 05:55 PM
Thanks.
Tags
TreeView
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or