Open bestvcboy opened 6 months ago
Using one GRID for three IMAGs will make everything normal. [Uploading MainPage.txt…]()
I think your Grid layout is the root issue:
You have a multiple Grids that are effectively at the same root level, with a drop target that's nested two deep. While it "works" there are better ways to represent this that require less nesting and would make more sense in a real application,
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiApp15.MainPage">
<Grid RowDefinitions="33*, 33*, 33*">
<Image
Grid.Row="0"
Source="dotnet_bot.png"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a race car number eight" >
<Image.GestureRecognizers>
<DragGestureRecognizer />
</Image.GestureRecognizers>
</Image>
<Image
Grid.Row="1"
Source="dotnet_bot.png" x:Name="drop1"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a race car number eight" >
<Image.GestureRecognizers>
<DropGestureRecognizer DragOver="DropGestureRecognizer_DragOver" />
</Image.GestureRecognizers>
</Image>
<Image x:Name="drop2"
Grid.Row="2"
Source="dotnet_bot.png"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a race car number eight" >
<Image.GestureRecognizers>
<DropGestureRecognizer DragOver="DropGestureRecognizer_DragOver_1" />
</Image.GestureRecognizers>
</Image>
</Grid>
</ContentPage>
It's not the multiple grids that are at issue here, it's that you're nesting them without setting the rows and columns, This causes them to be all at the "top level" of the visual tree, so it's not too surprising that one drop handle would override the other, since it can't be seen.
There may be a bug here with in MAUI with drop gestures are seen with the UI you wrote, but IMO I think there needs to be a more realistic case where you can hit this.
This is just a simplified model of mine. Because I'm developing a kind of mini-game where each object is a component, and this component uses nested Grids for positioning on the screen. The positions also change, so I used multiple GRIDs for nesting, which is why it turned out this way.
Verified this issue with Visual Studio 17.10.0 Preview 2. Can repro on Android platform with sample project.
Description
Description
Only one of multiple DropGestureRecognizers under Android will receive the message.(.NET 8) Description If there are multiple DropGestureRecognizers under a ContentPage in Android, only one will receive the message.
MauiApp15.zip
Steps to Reproduce
附件
Link to public reproduction project repository
No response
Version with bug
8.0.7 SR2
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
无
Relevant log output