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

Expanding nodes from XAML

3 Answers 80 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jani
Top achievements
Rank 1
Jani asked on 25 Feb 2009, 03:32 PM
How I can expand nodes from the RadTreeView using XAML?

The online manual (Expanding and collapsing nodes) describes the Property IsExpanded which is not available.
Does the RadTreeView control provides a XAML property like IsExpandedOnLoad (true: expands all levels)?

PS. based on our MVVM architecture, we can not expand the RadTreeView nodes from code behind.

Cheers,
Jani

3 Answers, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 27 Feb 2009, 08:03 AM
Hi Jani,

In XAML you can expand RatTreeView items by setting IsExpanded="True" in the desired RadTreeViewItem like this:

<navigation:RadTreeView    
           <navigation:RadTreeViewItem Header="test2" x:Name="test2" IsExpanded="True">
                <navigation:RadTreeViewItem Header="item3" x:Name="item3" />
                <navigation:RadTreeViewItem Header="test4" x:Name="test4" />
            </navigation:RadTreeViewItem >
</navigation:RadTreeView>

I hope this answers your question.

Regards,
Boryana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jani
Top achievements
Rank 1
answered on 27 Feb 2009, 09:04 AM
Hi Boryana,

I am using the ItemsSource property to bind the data to the RadTreeView. I don't have any RadTreeViewItems present, to set the IsExpanded property. The RadTreeView itself should provide such a property.

Cheers,
Jani
0
Accepted
Bobi
Telerik team
answered on 27 Feb 2009, 03:56 PM
Hi Jani,

In order to expand nodes in XAML when using ItemsSource you have to use the ItemsContainerStyle property of RadtreeView:

<Style TargetType="telerik:RadTreeViewItem" x:Key="TreeViewItemStyle">
             //Other setters
            <Setter Property="IsExpanded" Value="True"></Setter>
  </Style>

<telerik:RadTreeView
            x:Name="tree"
            ItemsSource="{Binding Root}"
             ItemContainerStyle="{StaticResource TreeViewItemStyle}" />

I hope this will solve your problem.

Regards,
Boryana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
Jani
Top achievements
Rank 1
Answers by
Bobi
Telerik team
Jani
Top achievements
Rank 1
Share this question
or