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

How to keep certain node collapsed?

2 Answers 56 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Manoj
Top achievements
Rank 1
Manoj asked on 22 Feb 2012, 06:20 AM
I am using TreeListView to show my data in hierarchical order. Here is simplified view of my xaml.

<RadTreeListView>
  <RadTreeListView.ChildTableDefinitions>
     <TreeListViewTableDefinition  ItemsSource="{Binding PropertiesList, Mode=OneWay}"  />
  </RadTreeListView.ChildTableDefinitions>
  <RadTreeListView.Columns>
      <GridViewColumn>
          <GridViewColumn.CellTemplate>           
            <!-- My control to be shown in read only mode -->
          </GridViewColumn.CellTemplate>
          <GridViewColumn.CellEditTemplate>
            <!-- My control to be shown in Edit mode -->
          </GridViewColumn.CellEditTemplate>
      </GridViewColumn>
  </RadTreeListView.Columns>
</RadTreeListView>

So far everything works fine. Data is being shown properly. Only the issue is when data is shown my tree has data in following format.
- section 1
  - item 1 in section 1
  - item 2 in section 1
  and so on items .....................
- section 2
  - item 1 in section 2
  - item 2 in section 2
  and so on items .....................
and so on sections........................

These section are created programmatically. Once my data is loaded, I want to expand all sections except a particular one. The methods that can be called on TreeListView after data load are ExpandAllHierarchyItems() OR CollapseAllHierarchyItems(). But this is not what I need. How can I set a particular section to be collapsed in this case?

I saw a method CollapseHierarchyItem() but I could not find the way to access that particular HierarchyItem and call this method on it. Could you please help out me with this issue?

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 27 Feb 2012, 07:58 AM
Hello,

 You can iterate Items collection of the treelist to achieve your goal. 

Kind regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Manoj
Top achievements
Rank 1
answered on 27 Feb 2012, 08:22 AM
Hi Vlad,

Thanks for your reply. Could you please provide more details, which event should be used in this case to iterate and some sample code for it?

Thanks,
Manoj Attal
Tags
TreeListView
Asked by
Manoj
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Manoj
Top achievements
Rank 1
Share this question
or