简体   繁体   English

将嵌套项目从一个列表框移动到asp.net中的另一个列表框

[英]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: 我知道如何将项目从一个列表框移动到另一个列表框,但是当它们像这样嵌套时不知道:

在此处输入图片说明

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. 谢谢。

Items that are shown in a nested way are just like regular items, only the DataTemplate changes. 以嵌套方式显示的项目与常规项目一样,只是DataTemplate发生了变化。
Say your item class contains 'title' (string) and 'members' (List(of String)), then your dataTemplate will look like : 假设您的项目类包含“标题”(字符串)和“成员”(列表(字符串)),那么您的dataTemplate将如下所示:

<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 ! 因此,要在两个列表框之间切换嵌套项目,只需...切换项目!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM