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

Edit doesn't work

2 Answers 36 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
StrandedPirate
Top achievements
Rank 1
StrandedPirate asked on 13 Jul 2010, 01:13 PM
When I edit a node and click away the text displayed remains the original text and not the new text I entered. My databound object gets updated to the correct value but the display on your treeview remains the old text. This is in the latest build to date. Is there some option I need to switch on?

 

 

 

<telerik:HierarchicalDataTemplate x:Key="TreeviewTemplate">

 

 

 

 

<StackPanel Orientation="Horizontal">

 

 

 

 

<TextBlock Text="{Binding Name, Mode=TwoWay}" />

 

 

 

 

</StackPanel>

 

 

 

 

</telerik:HierarchicalDataTemplate>

 

 

 

 

<telerik:RadTreeView Grid.Column="0" Grid.Row="1" PathSeparator="{Binding Source=tbl_Path, Path=PathSeperator}" ItemTemplate="{StaticResource TreeviewTemplate}"

 

 

 

 

 

 

 

ItemsSource="{Binding ElementName=tbl_PathDomainDataSource, Path=Data}"

 

 

 

 

 

 

 

SelectedValuePath="PathID" x:Name="FolderTreeView"

 

 

 

 

 

 

 

IsLoadOnDemandEnabled="True" LoadOnDemand="tbl_PathRadTreeView_LoadOnDemand"

 

 

 

 

 

 

 

IsLineEnabled="False" HorizontalAlignment="Stretch"

 

 

 

 

 

 

 

IsEditable="True" ExpanderStyle="{StaticResource ExpanderStyle}" Selected="FolderTreeView_Selected"

 

 

 

 

 

 

 

Margin="2,2,2,2">

 

</

 

 

telerik:RadTreeView>

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Kiril Stanoev
Telerik team
answered on 15 Jul 2010, 04:20 PM
Hello Joey,

The most important things you need to keep in mind when you want to edit a node are:

1. RadTreeView should have its IsEditable property set to true.
2. You need to specify an ItemEditTemplate. Most of the time, an ItemEditTemplate looks like this:

<DataTemplate x:Key="DataItemEditTemplate">
    <Grid>
        <TextBox Text="{Binding Name, Mode=TwoWay}" />
    </Grid>
</DataTemplate>

3. Your business object should implement INotifyPropertyChanged.

I've prepared an example demonstrating how to edit a node. Have a look at it and let me know if it helps.

All the best,
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
0
StrandedPirate
Top achievements
Rank 1
answered on 16 Jul 2010, 11:33 AM
The partial class that contained the Name field didn't implement INotifyPropertyChanged
After implementing that interface the edit works as expected now.
thx,
Joey
Tags
TreeView
Asked by
StrandedPirate
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
StrandedPirate
Top achievements
Rank 1
Share this question
or