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

While renaming the node there is no limited text(how to give limited String) for RadTreeView item

3 Answers 37 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Runjith
Top achievements
Rank 2
Runjith asked on 08 Jul 2014, 07:33 AM
HI,

While renaming the specific node,it is taking lengthy string value.There is no limited text(how to give limited String) for RadTreeView item.Please find the below screenshot.

regards,
Ranjith

3 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 09 Jul 2014, 10:25 AM
Hello Ranjith,

Indeed, the TextBox that is used when the RadTreeViewItem is in edit mode will give the text as much space as it needs. In order to limit the width of the edit box you can define an ItemEditTemplate and set the MaxWidth property of the element inside the template.
<telerik:RadTreeView IsEditable="True">
    <telerik:RadTreeView.ItemEditTemplate>
        <DataTemplate>
            <TextBox MaxWidth="200" />
        </DataTemplate>
    </telerik:RadTreeView.ItemEditTemplate>
</telerik:RadTreeView>

Please let me know if this helps.

Regards,
Martin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Runjith
Top achievements
Rank 2
answered on 11 Jul 2014, 10:25 AM
HI,

i tryed that way what you have given suggition,but that is not working.This is the user control tree which i am using.

Code behind I am creating the contextmenu inside the event: OnTreeViewItemMouseDown

Ex:

MenuItem a = new MenuItem();
      
                 this.ContextMenu = cMenu;
                     
cMenu.Items.Clear();
                       
a.Header = "Rename";
                       
cMenu.Items.Add(a);
                       
a.Click += RenameCM_Click;
                       
MenuItem b= new MenuItem();

                       
b.Header = "Delete";
                       
cMenu.Items.Add(b);                      
b.Click += DeleteCM_Click;

in UI just I declared like this.

       
<telerik:RadTreeView Name="tvexample"
IsEditable="True">

<telerik:RadTreeView.ItemEditTemplate>
                       
<DataTemplate>
                           
<TextBox MaxWidth="10" />
                       
</DataTemplate>
                   
</telerik:RadTreeView.ItemEditTemplate>
       
</telerik:RadTreeView>

In code behind(Runtime) I am adding items from list.

Regards,
Ranjith

0
Martin Ivanov
Telerik team
answered on 15 Jul 2014, 11:34 AM
Hello Ranjith,

I tested the ItemEditTemplate on my side and it is applied correctly. Can you please elaborate more on your case by letting me know what is the exact issue and sending me a sample project with your implementation, that demonstrates the reported behavior? This will allow me to test it locally and investigate further the reason behind the issue.

Thank you for any help you can provide.

Regards,
Martin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
TreeView
Asked by
Runjith
Top achievements
Rank 2
Answers by
Martin Ivanov
Telerik team
Runjith
Top achievements
Rank 2
Share this question
or