<ListView>
사용자가 끌어서 놓기를 통해 재정렬하기를 원하는 UWP XAML 이 있습니다. ListViewBase 의 CanReorderItems
속성 은 해당 기능을 제공하며 몇 가지 속성 만 필요합니다.
<ListView ItemsSource="{x:Bind Items}"
CanReorderItems="True"
AllowDrop="True"
DragItemsStarting="ListView_DragItemsStarting"
DragItemsCompleted="ListView_DragItemsCompleted">
<!-- ... -->
</ListView>
이렇게하면 ListView 내에서 항목을 끌어서 놓을 수 있으며 (제거 후 추가) CollectionChanged
에서 이벤트 가 발생 합니다 ItemsSource
. 그러나 DragItemsStarting
및 DragItemsCompleted
이벤트 는 발생하지 않습니다 .
이러한 이벤트를 사용하면 .NET Framework의 두 CollectionChanged
이벤트에 의존하는 대신 원자 적으로 드래그를 처리 할 수 ItemsSource
있습니다.
이러한 이벤트를 발생 시키려면 어떻게해야합니까?
ListView
S는 발생하지 않습니다 DragItemsStarting
와 DragItemsCompleted
하지 않는 이벤트 CanDragItems
ListView에 true로 설정됩니다
<ListView ItemsSource="{x:Bind Items}"
CanDragItems="True"
CanReorderItems="True"
AllowDrop="True"
DragItemsStarting="ListView_DragItemsStarting"
DragItemsCompleted="ListView_DragItemsCompleted">
<!-- ... -->
</ListView>
이 속성을 추가하면 이러한 이벤트가 실행된다는 것을 알 수 있습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다