使用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