Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListView CanReorderItems not working with custom ItemsPanel #9275

Closed
HO-COOH opened this issue Jan 22, 2024 · 3 comments
Closed

ListView CanReorderItems not working with custom ItemsPanel #9275

HO-COOH opened this issue Jan 22, 2024 · 3 comments
Labels
area-Lists ListView, GridView, ListBox, etc bug Something isn't working team-Controls Issue for the Controls team

Comments

@HO-COOH
Copy link

HO-COOH commented Jan 22, 2024

Describe the bug

It seems that using any custom panel as ItemsPanel for ListView, it can no longer reorder items. Built-in StackPanel works fine.

Steps to reproduce the bug

  1. Create a new WinUI3 project, install the CommunityToolkit.WinUI.Controls package
  2. Use this xaml
<Window ... 
    xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls">
    <ListView CanReorderItems="True" AllowDrop="True">
        <ListView.ItemsPanel>
            <ItemsPanelTemplate>
                <controls:WrapPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
        </ListView.ItemsPanel>

        <x:String>Item1</x:String>
        <x:String>Item2</x:String>
        <x:String>Item3</x:String>
    </ListView>
  1. Try drag and reorder the items. It only shows a red stop sign.

Expected behavior

Should be able to reorder the items.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5 Experimental 1: 1.5.231202003-experimental1

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@HO-COOH HO-COOH added the bug Something isn't working label Jan 22, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Jan 22, 2024
@bpulliam bpulliam added area-Lists ListView, GridView, ListBox, etc team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Jan 22, 2024
@FireCubeStudios
Copy link

FireCubeStudios commented Jan 22, 2024

Pretty sure this is intentional. toolkit wrap panels themselves has to include drag and drop support

@HO-COOH
Copy link
Author

HO-COOH commented Jan 22, 2024

Pretty sure this is intentional. toolkit wrap panels themselves has to include drag and drop support

Maybe that's true. Can you share an example to implement that with custom panel?

@ranjeshj
Copy link
Contributor

This is by design. The panels need to impliment some interfaces to participate in drag and drop. StackPanel impliments IInsertionPanel. https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.iinsertionpanel?view=winrt-22621. Not sure if that is sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Lists ListView, GridView, ListBox, etc bug Something isn't working team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

4 participants