使用Silverlight工具包可以非常轻松地启用基本拖放操作。ListBoxDragDropTarget防止ListBox填充其父控件
http://silverlightfeeds.com/post/1325/Silverlight_Toolkit_adds_DragDrop_targets.aspx
不幸的是它似乎是包装ListBoxDragDropTarget
螺丝了列表框,其是本身伸展到父控制的正常默认行为 - 例如在这个例子中一个网格单元。
<Grid Background="Yellow">
<toolKit:ListBoxDragDropTarget AllowDrop="True">
<ListBox x:Name="customerListBoxMain"
DisplayMemberPath="Name">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</toolKit:ListBoxDragDropTarget>
</Grid>
我会在这里结束与调整大小以适应其内容坐在一个黄色的盒子中间的小列表框(数据绑定到ListBox
后)。
没有任何数量的HorizontalAlignment=Stretch
等似乎能够得到它来填补父母的盒子。
我怎样才能让ListBox
填写Grid
?
事实证明,目前的拖动功能对我来说已经不够稳定了,而且我终究还是会遇到各种奇怪的事情。 – 2010-07-16 05:02:34