Reputation: 49
My requirement is:
What I've tried:
How would I accomplish my requirements?
Upvotes: 0
Views: 59
Reputation: 8220
You may consider using CommunityToolkit Popup. When you click the image, it will show a popup which you can customize the appearance to show any content you want.
Let's say a CollectionView showing some items,
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid>
<Label HorizontalOptions="Start" Text="{Binding Name}" />
<Image Source="dotnet_bot.png" HorizontalOptions="End">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</Image.GestureRecognizers>
</Image>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
And we implement the event handler in code behind. We set the anchor of the Popup to the Image, which made the Popup render close to the object.
private void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
{
var popup = new MyPopup();
//set the Anchor to the Button,
popup.Anchor = sender as Image;
this.ShowPopup(popup);
}
Of course you can Defining your Popup and customize your Popup to have at least 10 items (listview, collectionview or tableview, etc)
Upvotes: 0