Imir Hoxha
Imir Hoxha

Reputation: 1694

move nested items from one listbox to another listbox in asp.net

I know how to move items from one listbox to another, but not when they are nested like this:

enter image description here

Can anyone tell me how can I nest them in a list box and move them from one listbox to another just like in the image above?

Thank you.

Upvotes: 1

Views: 345

Answers (1)

GameAlchemist
GameAlchemist

Reputation: 19294

Items that are shown in a nested way are just like regular items, only the DataTemplate changes.
Say your item class contains 'title' (string) and 'members' (List(of String)), then your dataTemplate will look like :

<DataTemplate TargetType={x:Type l:MyClass}>
    <StackPanel>
       <TextBox Text:{Binding title} />
       <ItemsControl ItemsSource={Binding members} />
    </StackPanel>
 </DataTemplate>

So to switch a nested item between two Listbox, just... switch the item !

Upvotes: 1

Related Questions