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

RadTreeView setting IsSelected and IsExpanded properties brake the view

4 Answers 43 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Svetoslav
Top achievements
Rank 1
Svetoslav asked on 26 Mar 2019, 10:55 AM

Hello, I am trying to bind the items of my RadTreeView to IsSelected and IsExpanded but when I use all my items are not visible in the tree.

I use it like this:

<telerik:RadTreeView.ItemContainerStyle >
         <Style TargetType="telerik:RadTreeViewItem">
             <Setter Property="IsSelected" Value="{Binding IsSelected}" />
             <Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
         </Style>

I tried to add to the style BasedOn="{StaticResource RadTreeViewItemStyle}" but I received warning that the style cannot be resolved, how can I use it?

4 Answers, 1 is accepted

Sort by
0
Svetoslav
Top achievements
Rank 1
answered on 26 Mar 2019, 02:06 PM
I found workaround for me after posting this.
0
Svetoslav
Top achievements
Rank 1
answered on 26 Mar 2019, 02:36 PM

In fact it works when use the style like this:

<Style x:Key="selectTreeDialogStyle" TargetType="telerik:RadTreeViewItem" BasedOn="{StaticResource RadTreeViewItemStyle}">
    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
    <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
</Style>

 

But I still get error in the designer "
"The resource "RadTreeViewItemStyle" could not be resolved."

I have imported these:

 

0
Martin Ivanov
Telerik team
answered on 29 Mar 2019, 09:16 AM
Hello Svetoslav,

The BasedOn property points to a base style. In your case, this is the RadTreeViewItemStyle which you can get only if you use the NoXaml version of the Telerik dlls. Otherwise, you don't need to set BasedOn. I could recommend you to check the following articles and see if they help for resolving the issue:
Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Svetoslav
Top achievements
Rank 1
answered on 03 Apr 2019, 09:16 AM
Thanks for the articles.
Tags
TreeView
Asked by
Svetoslav
Top achievements
Rank 1
Answers by
Svetoslav
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or