Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1192
Edit/Rename XamWebTreeItem
posted

Using XamWebTree to populate folder structure and file name as leaf node.

I want to rename folder/file name (node.Header) .

I am populating tree dynamically by adding node (folder name & file name) to tree control. To edit any node (folder or file name), I am using ControlTemplate. This template

 

 

 

 

 

<ControlTemplate x:Name="controlTreeItemTemplate" TargetType="Ctl:XamWebTreeItem">

 

 

 

<TextBox x:Name="ModifyText" LostFocus="ModifyText_LostFocus" Loaded="ModifyText_Loaded"></TextBox>

 

 

 

</ControlTemplate>

On context menu rename click i am using following code to show template.

prevTemplate = selectedNode.Template ;

selectedNode.Template = controlTreeItemTemplate;

On ModifyText_LostFocus event, i reassign previous template.

selectedNode.Template =prevTemplate ; // Due to this statement i am getting error

selectedNode.Header = ModifyText.Text;

But it gives error.

Would please suggest how to avoid above error or achieve rename node funtionality.