Flyout Navigation - Mouse hover

Dani_S 4,171 Reputation points
2025-03-10T09:39:24.4233333+00:00

Hi,

In continue to https://learn.microsoft.com/en-us/answers/questions/2202802/flyout-navigation-improvements?page=1#answer-1989782

How I support mouse hover when navigation on collection view ?

I want Custom Cursor hand when hovering over an item in collection view in menu in Desktop.

want solution to this collection view, not influence other collection views in my app.

How i set the behavior to grid



<CollectionView.ItemTemplate> <DataTemplate x:DataType="vm:FlyoutPageItem"> <Grid Padding="5,10"> <Grid.ColumnDefinitions> <ColumnDefinition Width="30"/> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Image Source="{Binding IconSource}" /> <Label Grid.Column="1" Margin="20,0" Text="{Binding Title}" FontSize="20" FontAttributes="Bold" VerticalOptions="Center" /> </Grid> </DataTemplate> </CollectionView.ItemTemplate>

Thanks,

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,993 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 80,606 Reputation points Microsoft External Staff
    2025-03-11T04:48:22.56+00:00

    Hello,

    From Custom Cursor when hovering over View on Desktop #4552

    You can see MauiCursor by VladislavAntonyuk for all platforms. You can add cursorExtensions for different platforms. Then create a CursorBehavior and add CursorProperty. You can control cursor is hand by local:CursorBehavior.Cursor="Hand", I set it to the VerticalStackLayout in the CollectionView

    <CollectionView ItemsSource="{Binding LeaveSummarys}">
     <CollectionView.ItemTemplate>
       <DataTemplate>
       <Frame Padding="10" Margin="5" CornerRadius="10" BorderColor="Gray">
         <VerticalStackLayout  local:CursorBehavior.Cursor="Hand">
            <Label Text="{Binding Name}" FontSize="18" FontAttributes="Bold"/>
            <Label Text="{Binding TotalLeaveCount}" FontSize="16"/>
             <Label Text="{Binding LeaveTaken}" FontSize="16"/>
          </VerticalStackLayout>
       </Frame>
      </DataTemplate>
     </CollectionView.ItemTemplate>
    </CollectionView>
    

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.