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

Show Plus/Minus based on Property Value

2 Answers 108 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 04 Dec 2011, 05:38 PM
Hello!

I want to use some kind of dynamic loading using the RadTreeListView; so when the control gets loaded only the first level is loaded and when the user expands one item, its corresponding items should be loaded. Unfortunately there is no plus sign to expand when the item has not any elements yet! What I need is some kind of property, for example, HasChildren and based on that property there should be a plus sign or not. Otherwise I have to work with dummy items and I think that solution is not very clean and elegant. So I tried to use the HierarchyExpandButtonStyle but without luck - nothing is displayed when there are no child elements yet. How can something like that be achieved? Can one use the HierarchyExpandButtonStyle? Any workarounds?

A BIG, BIG thanks in advance,
Tim.

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 05 Dec 2011, 08:38 AM
Hi Tim,

 You can use IsExpandable property of TreeListViewRow to achieve your goal. With the official Q3 2011 binding is not supported to this property (you can use RowLoaded to set it explicitly) however with our upcoming latest build (later Today) you will be able to use is in style selectors and setter property value binding (Silverlight 5/WPF). Here is an example with StyleSelector:

           <telerik:RadTreeListVIew.RowStyleSelector>
                <telerik:ConditionalStyleSelector>
                    <telerik:StyleRule Condition="ShipCountry = 'France'">
                        <Style TargetType="telerik:TreeListViewRow">
                            <Setter Property="IsExpandable" Value="True" />
                        </Style>
                    </telerik:StyleRule> 
                    <telerik:StyleRule Condition="ShipCountry != 'France'">
                        <Style TargetType="telerik:TreeListViewRow">
                            <Setter Property="IsExpandable" Value="False" />
                        </Style>
                    </telerik:StyleRule>
                </telerik:ConditionalStyleSelector>
            </telerik:RadTreeListVIew.RowStyleSelector>

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Tim
Top achievements
Rank 1
answered on 05 Dec 2011, 12:44 PM
Hi Vlad,

thanks a lot for your answer and your example! Silverlight 5 - for my taste - is a little bit too beta; does anyone know something about the final release date? So with Silverlight 4 and the current Telerik release, I have to use the RowLoaded event? I'll give it a try...

Thanks again and all the best,
Tim.
Tags
TreeListView
Asked by
Tim
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Tim
Top achievements
Rank 1
Share this question
or