Home / Community & Support / Knowledge Base / RadControls for Silverlight / TreeView / TreeView Changes 2009.Q2 to 2009.Q3

TreeView Changes 2009.Q2 to 2009.Q3

Article Info

Rating: Not rated

Article information

Article relates to

 RadTreeView for Silverlight / WPF

Created by

 Miroslav Paskov

Last modified

 17 Nov 2009

Last modified by

 Miroslav Paskov


This article aims to detail changes in the TreeView from its 2009.Q2 to the 2009.Q3 version and any known issues with upgrading to the newer version.

Breaking Changes

1.1.  The CotnrolTemplate of the TreeView has changed.
Reason for change: ScrollViewers require their immediate content to be an object implementing IScrollInfo so that they will transfer scrolling information to it. This is required for the newly added virtualization to work.

How to diagnose the issue: You have a custom control template. No TreeViewItems are visible after you upgrade to the Q3 version of the TreeView.

How to fix: If you want to enable virtualization in the TreeView and you are using a custom style the ItemsPanel of the TreeView and the TreeViewItems needs to be changed to a TreeViewPanel. Add this setter to the styles of the TreeView and TreeView items:

<Setter Property="ItemsPanel">
    <Setter.Value>
        <ItemsPanelTemplate>
            <treeView:TreeViewPanel />
        </ItemsPanelTemplate>
    </Setter.Value>
</Setter>

where the treeView namespace is:

xmlns:treeView="clr-namespace:Telerik.Windows.Controls.TreeView;assembly=Telerik.Windows.Controls.Navigation"

 Also make sure that the content of the ScrollViewer in the ControlTemplate is just an ItemsPresenter. Move the other elements in the ScrollViewer outside it. The changes are outlined below:

The old 2009.Q2 template of the Silverlight TreeView, default theme:

<ControlTemplate TargetType="telerikNavigation:RadTreeView" x:Name="oldTreeViewTemplate">
    <Grid x:Name="RootElement">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="DropStates">
                <VisualState x:Name="DropImpossible" />
                <VisualState x:Name="DropPossible" />
                <VisualState x:Name="DropRootPossible">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ScrollViewer"
                                Storyboard.TargetProperty="Background">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <SolidColorBrush Color="#7fFCD590" />
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Border BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                Background="{TemplateBinding Background}">
            <ScrollViewer Padding="{TemplateBinding Padding}" IsTabStop="False"
                    x:Name="ScrollViewer" BorderThickness="0"
                    telerik:StyleManager.Theme="Office_Black"
                    telerik:ScrollViewerExtensions.EnableMouseWheel="True">
                <Grid>
  
                    <ItemsPresenter />
  
                    <Grid x:Name="DragBetweenItemsFeedback" Height="8"
                            Visibility="Collapsed" HorizontalAlignment="Left"
                            IsHitTestVisible="False" VerticalAlignment="Top">
  
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="8" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Ellipse
                                Stroke="{StaticResource DragBetweenItemsFeedback_BackgroundBrush}"
                                StrokeThickness="2" HorizontalAlignment="Left"
                                VerticalAlignment="Center" Width="8" Height="8" />
                        <Rectangle
                                Fill="{StaticResource DragBetweenItemsFeedback_BackgroundBrush}"
                                RadiusX="2" RadiusY="2" Margin="-2,3,0,0"
                                VerticalAlignment="Top" Height="2" Grid.Column="1" />
                    </Grid>
                </Grid>
            </ScrollViewer>
        </Border>
        <!-- Disabled -->
        <Rectangle x:Name="DisabledVisual" Fill="{StaticResource DisabledBrush}"
                IsHitTestVisible="true" Visibility="Collapsed" />
  
    </Grid>
</ControlTemplate>


The new 2009.Q3 template of the Silverlight TreeView, default theme:

<ControlTemplate TargetType="telerikNavigation:RadTreeView" x:Key="newTemplate">
    <Grid x:Name="RootElement">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="DropStates">
                <VisualState x:Name="DropImpossible" />
                <VisualState x:Name="DropPossible" />
                <VisualState x:Name="DropRootPossible">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ScrollViewer"
                                Storyboard.TargetProperty="Background">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <SolidColorBrush Color="#7fFCD590" />
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Border BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                Background="{TemplateBinding Background}">
            <Grid>
                <ScrollViewer Padding="{TemplateBinding Padding}" IsTabStop="False"
                        x:Name="ScrollViewer" BorderThickness="0"
                        telerik:StyleManager.Theme="Office_Black"
                        telerik:ScrollViewerExtensions.EnableMouseWheel="True">
  
                    <ItemsPresenter />
                </ScrollViewer>
  
                <Grid x:Name="DragBetweenItemsFeedback" Height="8" Visibility="Collapsed"
                        HorizontalAlignment="Left" IsHitTestVisible="False"
                        VerticalAlignment="Top" Margin="{TemplateBinding Padding}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="8" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Ellipse
                            Stroke="{StaticResource DragBetweenItemsFeedback_BackgroundBrush}"
                            StrokeThickness="2" HorizontalAlignment="Left"
                            VerticalAlignment="Center" Width="8" Height="8" />
                    <Rectangle
                            Fill="{StaticResource DragBetweenItemsFeedback_BackgroundBrush}"
                            RadiusX="2" RadiusY="2" Margin="-2,3,0,0"
                            VerticalAlignment="Top" Height="2" Grid.Column="1" />
  
                </Grid>
            </Grid>
        </Border>
        <!-- Disabled -->
        <Rectangle x:Name="DisabledVisual" Fill="{StaticResource DisabledBrush}"
                IsHitTestVisible="true" Visibility="Collapsed" />
  
    </Grid>
</ControlTemplate>

1.2.  RadTreeViewItemEditedEventArgs's NewText and OldText have been marked Obsolete.
Reason for change: NewText and OldText were not covering the scenario when RadTreeView was bound.
How to fix: Should use RadTreeViewItemEditedEventArgs's NewValue and OldValue properties instead.

Known Regressions

2.1. The TreeView throws an exception during DragDrop if placed in a panel that measures it with infinite width and the HorizontalScrollBarVisibility of the TreeView is Auto.

Who is affected:
If you place the TreeView is a ScrollViewer and its HorizontalScrollBarVisibility is "Auto" or in a Grid Column whose width is "Auto".

How to diagnose the issue: An exception is thrown "Value does not fall within the expected range." and the call stack contains the ShowBetweenItemsDragCue method.

Known workaround: A MaxWidth value can be set to the TreeView. Large enough value can be chosen so that it will not affect the layout of the application.

Status: The issue has been fixed. It will be released with the next internal build and the 2009.Q3 SP1


This article will be updated with information about known upgrade issues and their status.

Comments

There are no comments yet.
If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.