在 uwp 的堆栈面板中限制拖动项目?

Restrict dragged items within the stack panel in uwp?

我在 uwp 中实现了使用拖放重新排序的堆栈面板子项,但我不希望堆栈面板子项在拖动时离开堆栈面板,那么我该如何实现呢?

我不得不说,拖放 api 不能为堆栈面板实现这样的功能,我们建议您使用列表视图来替换包含 CanReorderItems 属性的视图。您可以将其设置为 true 以将项目拖动到您想要的索引。

<ListView CanDragItems="True" CanReorderItems="True" AllowDrop="True"
SelectionMode="Single" />