Silverlight set ListBoxDragDropTarget来自代码隐藏的子项/项
我有一个应用程序,它通过编程从代码隐藏中建立列表框。 我想让列表框中包含的元素可以拖动 我知道这可以通过使用ListBoxDragDropTarget在xaml中通过使用以下xaml代码实现:Silverlight set ListBoxDragDropTarget来自代码隐藏的子项/项,silverlight,xaml,Silverlight,Xaml,我有一个应用程序,它通过编程从代码隐藏中建立列表框。 我想让列表框中包含的元素可以拖动 我知道这可以通过使用ListBoxDragDropTarget在xaml中通过使用以下xaml代码实现: <toolkit:ListBoxDragDropTarget mswindows:DragDrop.AllowDrop="True"> <ListBox Width="200" Height="500" x:Name="FromBox" DisplayMemberPath="Fu
<toolkit:ListBoxDragDropTarget mswindows:DragDrop.AllowDrop="True">
<ListBox Width="200" Height="500" x:Name="FromBox" DisplayMemberPath="FullName">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</toolkit:ListBoxDragDropTarget>
不确定这是否可能
提前谢谢 最后解决了这个问题 最后,我将ListBoxDragDropTarget.content设置为列表框。其中包含多个对象
target.Content = listBox
然后我将目标添加到wrapPanel,最后将wrapPanel添加到我的主网格
wp.Children.Add(target)
grdApps.Children.Add(wp)
拖放功能现在正在工作 这似乎符合我的意见。请尝试target.AllowDrop=true,然后按照示例target.Children.AddFromBox中所示添加元素。让我知道它是否有效谢谢你的评论。但是,我们不确定是否有不同版本的Silverlight,但target的add属性不存在。弄明白了,我会把它作为答案贴出来。
wp.Children.Add(target)
grdApps.Children.Add(wp)