RadTreeView edit not comitting

2 posts, 1 answers
  1. Owen
    Owen avatar
    7 posts
    Member since:
    Apr 2009

    Posted 15 Feb 2010 Link to this post

        public class DataSource : DependencyObject 
        { 
            public List<DataSource> Children { getset; } 
     
            public string Name { getset; } 
     
            public DataSource() 
            { 
                Children = new List<DataSource>(); 
            } 
        } 
        <Window.Resources> 
            <local:DataSource x:Key="DataSource"
                <local:DataSource.Children> 
                    <local:DataSource Name="1"
                        <local:DataSource.Children> 
                            <local:DataSource Name="2"
                                <local:DataSource.Children> 
                                    <local:DataSource Name="3"
                                        <local:DataSource.Children> 
                                            <local:DataSource Name="4"/> 
                                        </local:DataSource.Children> 
                                    </local:DataSource> 
                                </local:DataSource.Children> 
                            </local:DataSource> 
                        </local:DataSource.Children> 
                    </local:DataSource> 
                </local:DataSource.Children> 
            </local:DataSource> 
        </Window.Resources> 
        <telerik:RadTreeView ItemsSource="{Binding Path=Children, Source={StaticResource DataSource}}" IsEditable="True"
            <telerik:RadTreeView.ItemTemplate> 
                <HierarchicalDataTemplate ItemsSource="{Binding Path=Children}"
                    <TextBlock Text="{Binding Path=Name}"/> 
                </HierarchicalDataTemplate> 
            </telerik:RadTreeView.ItemTemplate> 
            <telerik:RadTreeView.ItemEditTemplate> 
                <DataTemplate
                    <TextBox Text="{Binding Path=Name, Mode=TwoWay}"/> 
                </DataTemplate> 
            </telerik:RadTreeView.ItemEditTemplate> 
        </telerik:RadTreeView> 
    The above is the smallest reproduction I can find of this issue.
    Editing any node (by pressing F2) brings up the TextBox as it should.  However that TextBox is empty and a BindingExpression error occurs (as visible in the output window):

    System.Windows.Data Error: 40 : BindingExpression path error: 'Name' property not found on 'object' ''String' (HashCode=557208335)'. BindingExpression:Path=Name; DataItem='String' (HashCode=557208335); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')

    Making the Name property a proper DependencyProperty has no effect.  The DataItem seems to be getting changed.  Curiously, if you change DataSource to NOT extend DependencyObject (ie make it just a CLR object), it works as expected.  I cannot change my real hierarchy this way.  Am I doing something wrong or should I log in PITS?
  2. Answer
    Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 15 Feb 2010 Link to this post

    Hi Owen,

    Thank you for your feedback. A fix to this issue will be available with this week's internal build. I've also added 1000 Telerik points to your account. Let me know if you have additional questions or comments on the topic.

    Regards,
    Kiril Stanoev
    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.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top