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

Bug: Crash when setting IsVirtualization in a style setter

1 Answer 32 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
hwsoderlund
Top achievements
Rank 1
hwsoderlund asked on 14 Nov 2012, 02:31 PM
The following xaml crashes with the message "The property 'IsVirtualizing' was not found in type 'Telerik.Windows.Controls.RadTreeView'. [Line: 15 Position: 30]"

If I comment out the style setter and put IsVirtualizing="True" directly on the treeview it works fine.

I am using the latest internal build (RadControls_for_Silverlight_5_2012_3_1112_DEV_hotfix).

<UserControl x:Class="TelerikTestProject01.MainPage_TreeView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="400">
 
    <UserControl.Resources>
 
        <Style x:Key="RadTreeViewStyle"
               TargetType="telerik:RadTreeView">
            <Setter Property="IsVirtualizing"
                    Value="True"></Setter>
        </Style>
 
    </UserControl.Resources>
 
    <Grid x:Name="LayoutRoot">
 
        <telerik:RadTreeView x:Name="RadTreeView1"
                           Style="{StaticResource RadTreeViewStyle}"></telerik:RadTreeView>
 
    </Grid>
</UserControl>

1 Answer, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 16 Nov 2012, 10:21 AM
Hi Henrik,

You can only set a DependencyProperty using a Style.Setter. However, in the implementation of the RadTreeView, the IsVirtualizing property is defined as a simple boolean object which internally sets the TreeViewPanel.IsVirtualizing DependencyProperty. This is why if you need to control the virtualizaiton  feature through a style, you need to set the  of the TreeViewPanel.IsVirtualizing property as shown in the following snippet:
Grid x:Name="LayoutRoot">
    <Grid.Resources>
        <Style x:Key="RadTreeViewStyle" TargetType="telerik:RadTreeView">
            <Setter Property="telerik:TreeViewPanel.IsVirtualizing" Value="True"/>
        </Style>
    </Grid.Resources>
    <telerik:RadTreeView x:Name="RadTreeView1" Style="{StaticResource RadTreeViewStyle}" />
</Grid>

Let me know if you have any other questions.

Regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TreeView
Asked by
hwsoderlund
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or