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

RadTreeView edit not comitting

1 Answer 90 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Owen
Top achievements
Rank 1
Owen asked on 15 Feb 2010, 01:51 PM
    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?

1 Answer, 1 is accepted

Sort by
0
Accepted
Kiril Stanoev
Telerik team
answered on 15 Feb 2010, 03:02 PM
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.
Tags
TreeView
Asked by
Owen
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or