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

4 posts, 0 answers
  1. Runjith
    Runjith avatar
    26 posts
    Member since:
    Mar 2014

    Posted 08 Jul 2014 Link to this post

    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
  2. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 09 Jul 2014 Link to this post

    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Runjith
    Runjith avatar
    26 posts
    Member since:
    Mar 2014

    Posted 11 Jul 2014 in reply to Martin Link to this post

    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

  5. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 15 Jul 2014 Link to this post

    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.
     
Back to Top