相关疑难解决方法(0)

将项目拖放到同一ListView中

我有以下 ListView

<ListView Name="listAccounts" Width="300" AllowDrop="True" SelectionMode="Single" CanDragItems="True" CanDrag="True" CanReorderItems="True" Background="{ThemeResource myBackground}" DragItemsStarting="listAccounts_DragItemsStarting" Drop="listAccounts_Drop">
Run Code Online (Sandbox Code Playgroud)

并将我的事件处理程序定义为

private void listAccounts_DragItemsStarting(object sender, DragItemsStartingEventArgs e)
{
    e.Data.SetData("itemIndex", (e.Items[0] as AccountList).Text.ToString());
}

private async void listAccounts_Drop(object sender, DragEventArgs e)
{
    string itemIndexString = await e.Data.GetView().GetTextAsync("itemIndex");
}
Run Code Online (Sandbox Code Playgroud)

我不知道还能做些什么.我想在同一个列表中实现列表项的移动.

c# xaml drag-and-drop uwp

2
推荐指数
1
解决办法
1608
查看次数

标签 统计

c# ×1

drag-and-drop ×1

uwp ×1

xaml ×1