Skip to content

Conversation

@StephaneDelcroix
Copy link
Contributor

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

The XAML file references Invoked="OnInvoked" on a SwipeItem, but the handler was missing from the code-behind. This caused XSG (XAML Source Generator) to report an error when trying to compile the sample with SourceGen.

Changes

  • Added the missing OnInvoked event handler to CustomSwipeControl.xaml.cs
  • Removed [XamlCompilation(XamlCompilationOptions.Skip)] attribute since the file can now be compiled properly

Fixes #33877

The XAML references Invoked="OnInvoked" but the handler was missing from the code-behind.
Also removed [XamlCompilation(Skip)] as it's no longer needed.
Copilot AI review requested due to automatic review settings February 3, 2026 21:37
@StephaneDelcroix StephaneDelcroix added this to the .NET 10.0 SR4 milestone Feb 3, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a compilation error in the CustomSwipeControl sample that occurred when using XAML Source Generator (XSG). The XAML file referenced an event handler OnInvoked for a SwipeItem's Invoked event, but the handler was missing from the code-behind file.

Changes:

  • Added the missing OnInvoked event handler to handle SwipeItem invocation
  • Removed the [XamlCompilation(XamlCompilationOptions.Skip)] attribute, which was previously required to skip compilation due to the missing handler
  • Updated using statements to include System namespace (required for EventArgs) and removed unused Microsoft.Maui.Controls.Xaml namespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[XSG] SwipeItem.Invoked event handler not found

2 participants