DragDropBehavior and TextBox

2 posts, 0 answers
  1. Manuel
    Manuel avatar
    32 posts
    Member since:
    Sep 2013

    Posted 01 Oct 2015 Link to this post

    Hi, II have a RadListBox with an attached DragDropBehavior and a custom itemTemplate:

                <TextBox Text="{Binding Name}" />

    Technically everything works as expected, apart of the fact that reordering elements via drag&drop is nearly impossible.

    Replacing the TextBox with a TextBlock fixes the issue but, of course, is not a viable option: the "Name" property should be editable...

    Any advice on this?

  2. Nasko
    Nasko avatar
    699 posts

    Posted 02 Oct 2015 Link to this post

    Hello Manuel,

    RadListBox control as any other selector control is not designed to support built-in inline editing of the items - that caused the observed by you behavior when you place TextBox inside its ItemTemplate. The mentioned inline editing is not available in the default ListBox control which is why it has not been consider to be implemented as a built-in feature in the RadListBox control.

    What we could suggest you for you concrete scenario in order to support editing is to place TextBlock inside the ItemTemplate. So, when you drag and reorder the items the TextBlock should be visible while when you want to edit the item you need to double click the item and the TextBox will become visible.

    We have created a sample project that demonstrates that and you could run and evaluate it.

    Please, notice that this is just a custom implementation and has not been tested for all scenarios and you might need to improve it.

    Hope this helps.

    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 Feedback Portal and vote to affect the priority of the items
Back to Top