Bug: Crash when setting IsVirtualization in a style setter

2 posts, 0 answers
  1. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 14 Nov 2012 Link to this post

    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>
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 16 Nov 2012 Link to this post

    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.

  3. DevCraft banner
Back to Top