Skip to content

Commit

Permalink
Disable pointer hover on mobile platforms (#1500)
Browse files Browse the repository at this point in the history
  • Loading branch information
williambohrmann3 authored Jul 30, 2024
1 parent ee249ea commit 66a97ad
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/MAUI/Maui.Samples/Views/CategoryPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ private async void SearchClicked(object sender, EventArgs e)
await Navigation.PushAsync(new SearchPage(), false);
}

// The favorites icon can flicker when using a pen as pointer.
private void PointerGestureRecognizer_PointerEntered(object sender, PointerEventArgs e)
{
#if WINDOWS || MACCATALYST
var view = (Border)sender;

var grid = (Grid)view.Content;
Expand All @@ -79,10 +81,12 @@ private void PointerGestureRecognizer_PointerEntered(object sender, PointerEvent
imageButton.IsVisible = true;

Console.WriteLine("PointerRecognized");
#endif
}

private void PointerGestureRecognizer_PointerExited(object sender, PointerEventArgs e)
{
#if WINDOWS || MACCATALYST
var view = (Border)sender;

var grid = (Grid)view.Content;
Expand All @@ -92,6 +96,7 @@ private void PointerGestureRecognizer_PointerExited(object sender, PointerEventA
string sampleName = (string)imageButton.CommandParameter;

imageButton.IsVisible = false || SampleManager.Current.IsSampleFavorited(sampleName);
#endif
}

protected override void OnNavigatedTo(NavigatedToEventArgs args)
Expand Down

0 comments on commit 66a97ad

Please sign in to comment.