Skip to content

[Windows] Fix horizontal swipes not working when SwipeItems are set in all directions#24

Draft
Copilot wants to merge 10 commits intomainfrom
copilot/fix-23
Draft

[Windows] Fix horizontal swipes not working when SwipeItems are set in all directions#24
Copilot wants to merge 10 commits intomainfrom
copilot/fix-23

Conversation

Copy link

Copilot AI commented Jul 31, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description

This PR fixes an issue on Windows where horizontal swipes (left/right) would not work when SwipeItems are configured for all four directions (LeftItems, RightItems, TopItems, and BottomItems) on a SwipeView.

Root Cause

The issue was caused by a timing inconsistency in the Windows SwipeView handler:

  • MapTopItems and MapBottomItems methods were setting SwipeItems immediately when called
  • MapLeftItems and MapRightItems methods were deferring the setting until after the control's IsLoaded event
  • This timing difference caused conflicts in the underlying WinUI SwipeControl when all four directions were configured simultaneously

The OnLoaded event handler was only updating LeftItems and RightItems, leaving TopItems and BottomItems to be set at a different time, which interfered with the horizontal swipe functionality.

Solution

The fix ensures consistent timing by:

  1. Adding IsLoaded checks to MapTopItems and MapBottomItems methods to defer their execution until the control is loaded
  2. Updating the OnLoaded method to include TopItems and BottomItems alongside LeftItems and RightItems
  3. Ensuring all four directions are set at the same time after the WinUI SwipeControl has fully loaded

Changes Made

  • Modified SwipeViewHandler.Windows.cs to defer all SwipeItems setting until after control load
  • Added comprehensive test case Issue23.cs to verify the fix and prevent regressions
  • Updated comments to reflect that all SwipeItems (not just Left/Right) need consistent timing

Testing

The fix includes both a HostApp test page and automated UI tests that verify:

  • Horizontal swipes work correctly when all four directions are configured
  • Vertical swipes continue to work as expected
  • All SwipeItems are properly triggered when swiped

Fixes #23.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 11vvsblobprodcus336.vsblob.vsassets.io
    • Triggering command: dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --filter *SwipeView* --verbosity normal (dns block)
  • 1p7vsblobprodcus324.vsblob.vsassets.io
    • Triggering command: dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --filter *SwipeView* --verbosity normal (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
  • 4zjvsblobprodcus390.vsblob.vsassets.io
    • Triggering command: dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj --framework net9.0-android (dns block)
    • Triggering command: dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --filter *SwipeView* --verbosity normal (dns block)
  • 6s7vsblobprodcus313.vsblob.vsassets.io
    • Triggering command: dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --filter *SwipeView* --verbosity normal (dns block)
  • ajhvsblobprodcus363.vsblob.vsassets.io
    • Triggering command: dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --filter *SwipeView* --verbosity normal (dns block)
  • d0svsblobprodcus381.vsblob.vsassets.io
    • Triggering command: dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --filter *SwipeView* --verbosity normal (dns block)
  • e7bvsblobprodcus348.vsblob.vsassets.io
    • Triggering command: dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --filter *SwipeView* --verbosity normal (dns block)
  • kxqvsblobprodcus376.vsblob.vsassets.io
    • Triggering command: dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --filter *SwipeView* --verbosity normal (dns block)
  • m16vsblobprodcus374.vsblob.vsassets.io
    • Triggering command: dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --filter *SwipeView* --verbosity normal (dns block)
  • o3svsblobprodcus318.vsblob.vsassets.io
    • Triggering command: dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --filter *SwipeView* --verbosity normal (dns block)
  • rcxvsblobprodcus328.vsblob.vsassets.io
    • Triggering command: dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --filter *SwipeView* --verbosity normal (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>
Copilot AI changed the title [WIP] [Windows] Horizontal swipes not working when SwipeItems are set in all directions [Windows] Fix horizontal swipes not working when SwipeItems are set in all directions Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] Horizontal swipes not working when SwipeItems are set in all directions

2 participants