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

RadTreeView items default expanded=true with container binding

4 Answers 231 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 14 Mar 2011, 06:03 AM
Hi,

A little help with this problem would be great.

I have a RadTreeView as follows

<Controls:RadTreeView  
            Name="TreeView"
            IsVirtualizing="True"
            ItemTemplate="{StaticResource NodeTemplate}"
            ItemsSource="{Binding Tree}">
</Controls:RadTreeView>


with a hierarchical data template as follows

<telerik:HierarchicalDataTemplate x:Key="NodeTemplate" ItemsSource="{Binding Children}" telerik:ContainerBinding.ContainerBindings="{StaticResource ContainerBindings}">
    <MyTemplateClass ItemText="{Binding Name}" />
</telerik:HierarchicalDataTemplate>


and I am also binding the IsExpanded property to the datacontext of MyTemplateClass using container bindings as follows

<telerik:ContainerBindingCollection x:Key="ContainerBindings">
    <telerik:ContainerBinding PropertyName="IsExpanded" Binding="{Binding Expanded, Mode=TwoWay}" />
</telerik:ContainerBindingCollection>


I have an item X, which has a set 10 items inside it, and one of them, "Y", has many items inside it.  When I expand X, Y appears to expand and then unexpand, creating a very stuttered animation.  I have placed a converter on the container binding and have found that Y indeed is first set to true and then to false.  I have also debugged the property setter in the datacontext for MyTemplateClass and found that the binding source is never set to true, it remains false.

I should also say that if I turn virtualising off then the problem goes away, the animation is smooth and Y is not expanded.

I would like to keep Y false so that it does not expand when I expand X but cannot find where to make this setting.  Should I be looking to edit a template or should I try to change it in the converter or something else?

Hope this makes sense.

Thanks in advance,
Chris

4 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 14 Mar 2011, 02:27 PM
Hello Chris,

Could you please send us a runnable sample demonstrating the issue? This will be highly appreciated since we are seriously interested in investigating this and we could advice you faster this way. You can also mention the exact version of the dlls that you use.Thank you in advance for your cooperation.

All the best,
Petar Mladenov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Chris
Top achievements
Rank 1
answered on 15 Mar 2011, 12:47 AM
Hi Petar,

Thanks for your reply.  http://www.sendspace.com/file/kdntkq is a solution reproducing the problem.  If you expand node 5 you will hopefully see the problem.

I have tried with both these assemblies..

Telerik.Windows.Controls 2010.2.924.1040
Telerik.Windows.Controls.Navigation 2010.2.924.1040

...and these assemblies...

Telerik.Windows.Controls 2010.3.1110.1040
Telerik.Windows.Controls.Navigation 2010.3.1110.1040

...but the problem occurs with both.

I hope this enough to work with.

Regards,
Chris
0
Petar Mladenov
Telerik team
answered on 17 Mar 2011, 04:44 PM
Hi Chris,

I managed to view this virtualization issue. The good news is that is resolved from the Q3 2010 SP1 (1314) and you can examine this in the attached solution. I've also noticed that your root collection is List which is bad practice. You better replace it with ObservableCollection. Feel free to ask if you need more info.

Kind regards,
Petar Mladenov
the Telerik team
0
Chris
Top achievements
Rank 1
answered on 18 Mar 2011, 11:34 AM
Hi Petar,

Thanks for the solution.  It works perfectly with the new binaries - just downloaded 2011.1 :)

Regards,

Chris
Tags
TreeView
Asked by
Chris
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Chris
Top achievements
Rank 1
Share this question
or