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

edit RadRtreeviewItem problem

1 Answer 101 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 17 Dec 2012, 10:49 AM
Hello!
the project as the attach picture. When I click on the Create button continuously to creat document,after that, I press F2 to edit documents created, the results of the edit box is empty,why? the problem as the 3.png of the attach file. But after I created the file, use the mouse to click in the edit box next to,as the 1.png attach file, There is no the problem. The mouse does not click elsewhere, always click the Create button, Is previously created file will be the CancelEdit ()?

the xaml code:
When I create the new document, I will set the IsInEditMode=true, and I use MVVM
<UserControl.Resources>
<DataTemplate x:Key="childrenDocument">
<StackPanel Orientation="Horizontal">
<Image Width="24" Height="24" Source="/Fujitsu.iDM.View.Impl;component/Icons/128/image-folder.png"></Image>
<TextBlock Text="{Binding Name, Mode=TwoWay}" />
</StackPanel>
</DataTemplate>
<HierarchicalDataTemplate x:Key="rootDocument" ItemsSource="{Binding Mode=TwoWay, Path=ChildrenDocuments}"
ItemTemplate="{StaticResource childrenDocument}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name, Mode=TwoWay}"/>
</StackPanel>
</HierarchicalDataTemplate>
<Style x:Key="treeViewItemStyle" TargetType="telerik:RadTreeViewItem">
<Setter Property="IsInEditMode" Value="{Binding IsInEditMode, Mode=TwoWay}" />
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<Setter Property="IsExpanded" Value="true" />
</Style>
</UserControl.Resources>
<StackPanel>
<telerik:RadTreeView x:Name="radTreeNav" PreviewSelectionChanged="RadTreeView_PreviewSelectionChanged" IsEditable="true" FontWeight="Normal"
SelectedItem="{Binding NavBarSelectedDocument, Mode=OneWayToSource}" ItemContainerStyle="{StaticResource treeViewItemStyle}"
IsLineEnabled="True" ItemTemplate="{StaticResource rootDocument}" ItemsSource="{Binding RootDocuments}" >
<telerik:RadTreeView.ItemEditTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Width="24" Height="24" Source="/Fujitsu.iDM.View.Impl;component/Icons/128/image-folder.png"></Image>
<TextBox Text="{Binding Path=Name, Mode=TwoWay}"/>
</StackPanel>
</DataTemplate>
</telerik:RadTreeView.ItemEditTemplate>
</telerik:RadTreeView>
</StackPanel>

1 Answer, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 19 Dec 2012, 04:09 PM
Hi Bill,

As far as I understand your issue is the following:
When you add a new RadTreeViewItem and try to edit it, you get an empty TextBox. This can be caused of the type of your business collection. Are you using the ObservableCollection<T> class which supports the two way binding? Also, can you please tell me what is the version of your dlls? Is it possible for you to send us your project so we will be able to investigate this behavior and suggest the best approach for you?

Regarding your last question, I can not really understand what you want to ask when you say: "Is previously created file will be the CancelEdit ()?". Can you please clarify your point?

Regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TreeView
Asked by
Bill
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or