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

PropertyChanged not propagating down tree

1 Answer 71 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Griffith Townsend
Top achievements
Rank 1
Griffith Townsend asked on 10 Mar 2010, 10:54 PM
I'm binding a RadTreeView to a hierarchical data structure representing folders. The folder structure itself has been unit tested and properly fires the PropertyChanged event as children are added, updated, etc. This also works completely in the Microsoft TreeView control. However, the same collection, when bound to a RadTreeView, fails to fire collection updated events on any node past the first level. On looking behind the scenes, as I'm adding a node to the grandchild node it peeks at the propertychanged event of the parent and binds to it - in every case below the first level, the event is null.

Is there a setting or configuration that's required in your Hierarchical Data Template or TreeView to get it to actually update as child nodes are edited? Everything works perfectly well in the first level of the hierarchy, then fails beyond that.

The TreeView components are identified below.

<UserControl.Resources> 
        <ControlTemplate x:Key="headerTemplate"
            <StackPanel Orientation="Horizontal"
                <Image Source="/Astria.UI.Controls;Component/Assets/Eclipse/Images/FOLDER16.png" Width="16" Height="16" /> 
                <TextBlock Text="{Binding Header}" /> 
            </StackPanel> 
        </ControlTemplate> 
        <core:HierarchicalDataTemplate x:Key="folderTemplate" ItemsSource="{Binding Children}"
                <StackPanel Orientation="Horizontal"
                    <Image Source="/Astria.UI.Controls;Component/Assets/Eclipse/Images/FOLDER16.png" Width="16" Height="16" /> 
                    <TextBlock Name="TemplateText" Text="{Binding Name}" x:Uid="{Binding id}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  /> 
                </StackPanel> 
        </core:HierarchicalDataTemplate> 
 
        <DataTemplate x:Key="folderEditTemplate"
            <Border BorderThickness="0" Padding="2,2"
                <StackPanel Orientation="Horizontal"
                    <Image Source="/Astria.UI.Controls;Component/Assets/Eclipse/Images/FOLDER16.png" Width="16" Height="16" /> 
                    <TextBox Name="folderTextBox" Text="{Binding Name, Mode=TwoWay}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> 
                </StackPanel> 
            </Border> 
        </DataTemplate> 
             
    </UserControl.Resources> 
     
    <Grid x:Name="LayoutRoot" Background="{x:Null}"
        <telerik:RadTreeView HorizontalAlignment="Left" x:Name="folderView" Edited="RadTreeViewItem_Edited" VerticalAlignment="Top" SelectedValuePath="id" IsExpandOnSingleClickEnabled="True" IsEditable="True" ItemEditTemplate="{StaticResource folderEditTemplate}" SelectedItem="{Binding SelectedFolder}"
            <telerik:RadTreeViewItem x:Uid="root" Header="Folders" ItemTemplate="{StaticResource folderTemplate}" ItemsSource="{Binding FolderStructure}" HorizontalAlignment="Stretch"
                <telerik:RadTreeViewItem.HeaderTemplate> 
                    <DataTemplate> 
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch"
                            <Image Source="/Astria.UI.Controls;Component/Assets/Eclipse/Images/folder_document.png" Width="16" Height="16" /> 
                            <TextBlock Text="Folders" Padding="4,0" HorizontalAlignment="Stretch" /> 
                        </StackPanel> 
                    </DataTemplate> 
                </telerik:RadTreeViewItem.HeaderTemplate> 
            </telerik:RadTreeViewItem> 
         <telerik:RadContextMenu.ContextMenu> 
            <telerik:RadContextMenu x:Name="contextMenu" ItemClick="contextMenu_ItemClick"
                    <telerik:RadMenuItem Header="New Folder" Command="{Binding FolderCreate}" CommandParameter="{Binding SelectedFolder}"
                        <telerik:RadMenuItem.Icon> 
                            <Image Source="/Astria.UI.Controls;Component/Assets/Eclipse/Images/menu_folder_add.png" HorizontalAlignment="Left" > 
                            </Image> 
                        </telerik:RadMenuItem.Icon> 
                    </telerik:RadMenuItem> 
                    <telerik:RadMenuItem Header="Edit"
                        <telerik:RadMenuItem.Icon> 
                            <Image Source="/Astria.UI.Controls;Component/Assets/Eclipse/Images/menu_folder_edit.png" HorizontalAlignment="Left" > 
                            </Image> 
                        </telerik:RadMenuItem.Icon> 
                    </telerik:RadMenuItem> 
                    <telerik:RadMenuItem Header="Delete"
                        <telerik:RadMenuItem.Icon> 
                            <Image Source="/Astria.UI.Controls;Component/Assets/Eclipse/Images/menu_folder_delete.png" HorizontalAlignment="Left" > 
                            </Image> 
                        </telerik:RadMenuItem.Icon> 
                    </telerik:RadMenuItem> 
                </telerik:RadContextMenu> 
        </telerik:RadContextMenu.ContextMenu> 
        </telerik:RadTreeView> 
    </Grid> 
     
    

1 Answer, 1 is accepted

Sort by
0
Miro Miroslavov
Telerik team
answered on 11 Mar 2010, 01:57 PM
Hi Griffith Townsend,

We were unable reproduce your issue. In the attached project sub items are updated properly. Can you please modify it and send it back so we can reproduce the problem.

All the best,
Miro Miroslavov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
Griffith Townsend
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
Share this question
or