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

DragDropBehavior and TextBox

1 Answer 67 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Manuel
Top achievements
Rank 1
Manuel asked on 01 Oct 2015, 10:11 AM

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

<telerik:RadListBox.ItemTemplate>
    <DataTemplate>
        <Grid>
            <TextBox Text="{Binding Name}" />
        </Grid>
    </DataTemplate>
</telerik:RadListBox.ItemTemplate>

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?

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 02 Oct 2015, 11:45 AM
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.

Regards,
Nasko
Telerik
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
Tags
ListBox
Asked by
Manuel
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or