If I use border instead of frame, how do I stop the mobile click event from going through? #29902
-
After upgrading from .NET 8 to .NET 9, I saw this warning: It's like this: <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Grid.ColumnSpan="3" Command="{Binding TestCommand}"/>
<Frame Background="Yellow"/>
<Border Grid.Column="2" Background="Green"/>
</Grid> In Android devices, clicking on the yellow frame area (on the left) will not trigger the command, while clicking on the blue button (in the center) and the green border (on the right) will trigger it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You can use a "transparent" button to absorb mouse clicks, e.g. <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Grid.ColumnSpan="3" Command="{Binding TestCommand}"/>
<!-- <Frame Background="Yellow"/> -->
<Grid>
<Border />
<Button Opacity="0" />
</Grid>
<Border Grid.Column="2" Background="Green"/>
</Grid> |
Beta Was this translation helpful? Give feedback.
So you have a button that appears tappable to a user, that you cannot actually tap?
Putting aside the usability of that, I would expect adding a tap gesture to the border would likely achieve what you want.