Description
Adding a gesture recognizer on a ContentView on Windows platform does not work unless you set a background.
Works fine on iOS and Android.
Steps to Reproduce
Using MAUI UITest project in MauiProgram.user.cs
namespace Maui.Controls.Sample;
public partial class MauiProgram
{
static partial void OverrideMainPage(ref Page mainPage)
{
var contentPage = new ContentPage();
var grid = new Grid();
var contentView = new ContentView();
var tap = new TapGestureRecognizer();
tap.Tapped += (s, e) =>
{
Console.WriteLine("Click");
};
contentView.GestureRecognizers.Add(tap);
grid.Add(contentView);
contentPage.Content = grid;
// Uncommenting this makes the tap gesture recognizer work
//contentView.Background = Colors.Red;
mainPage = contentPage;
}
}
Link to public reproduction project repository
No response
Version with bug
9.0.110 SR12
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
No response
Did you find any workaround?
Setting a Colors.Transparent background, or use Grid instead of ContentView.
I believe Grid is working thanks to the InputTransparent mapper.
|
internal static void UpdatePlatformViewBackground(this LayoutPanel layoutPanel, ILayout layout) |
|
{ |
|
layoutPanel.UpdateInputTransparent(layout.InputTransparent, layout?.Background?.ToPlatform()); |
|
} |
Relevant log output
Description
Adding a gesture recognizer on a
ContentViewon Windows platform does not work unless you set a background.Works fine on iOS and Android.
Steps to Reproduce
Using MAUI UITest project in
MauiProgram.user.csLink to public reproduction project repository
No response
Version with bug
9.0.110 SR12
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
No response
Did you find any workaround?
Setting a
Colors.Transparentbackground, or useGridinstead ofContentView.I believe
Gridis working thanks to theInputTransparentmapper.maui/src/Core/src/Platform/Windows/ViewExtensions.cs
Lines 279 to 282 in 27c65e9
Relevant log output