Is possible to hide parent node?

4 posts, 1 answers
  1. Chris
    Chris avatar
    23 posts
    Member since:
    May 2011

    Posted 28 Aug 2012 Link to this post

    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.

     


  2. Chris
    Chris avatar
    23 posts
    Member since:
    May 2011

    Posted 28 Aug 2012 Link to this post

    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.




     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Answer
    Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 30 Aug 2012 Link to this post

    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.

  5. Chris
    Chris avatar
    23 posts
    Member since:
    May 2011

    Posted 30 Aug 2012 Link to this post

    Thanks.
Back to Top