墨梅 发表于 2013-1-2 23:14:58

解决Silverlight在ChildWindow中进行DragDrop操作问题

<div id="cnblogs_post_body">   在Codeplex网站上Silverlight Toolkit中,提供了Items controls 控件的拖拽操作支持,可以很方便的对Items Controls(如:ListBox,TreeView)进行拖拽操作。更多有关示例可以查看Silverlight Toolkit Demo。
   首先下载 Toolkit 安装包,新建一个Silverlight应用程序,添加对System.Windows.Controls.Toolkit.dll引用,在XAML中添加命名空间xmlns:toolkit ="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" 的引用。因为ListBoxDragDropTarget在该命名空间下。
   添加两个ListBox,并分别添加到ListBoxDragDropTarget中,将AllDrop设置为True。
<div class="cnblogs_code" style="background-color: #f5f5f5; border: #cccccc 1px solid; padding: 5px;">       <toolkit:ListBoxDragDropTarget Grid.Column="0" Grid.Row="3"                AllowDrop="true" HorizontalContentAlignment="Stretch"                VerticalContentAlignment="Stretch" Width="200">            <ListBox x:Name="fromListBox" DisplayMemberPath="Name"                  SelectionMode="Multiple">            </ListBox>            </toolkit:ListBoxDragDropTarget>       <toolkit:ListBoxDragDropTarget Grid.Column="0" Grid.Row="3"                AllowDrop="true" HorizontalContentAlignment="Stretch"                VerticalContentAlignment="Stretch" Width="200" >       <ListBox x:Name="toListBox" DisplayMemberPath="Name" SelectionMode="Multiple" >                <ListBox.ItemsPanel>                  <ItemsPanelTemplate>                        <StackPanel Orientation="Vertical" />                  </ItemsPanelTemplate>                </ListBox.ItemsPanel>            </ListBox>       </toolkit:ListBoxDragDropTarget>
页: [1]
查看完整版本: 解决Silverlight在ChildWindow中进行DragDrop操作问题