From 8a5479e476b342768353903bd2ea2c7abb5a8ce6 Mon Sep 17 00:00:00 2001 From: ZeBen Date: Fri, 8 Mar 2024 09:12:48 +0100 Subject: [PATCH] Update README.md --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 716a641..bda11d6 100644 --- a/README.md +++ b/README.md @@ -62,11 +62,24 @@ UIAlertController on iOS. MaterialAlertDialog on android. ```csharp Task Menu(CancellationToken dismiss, bool userCanDismiss, string? title, string description, int defaultActionIndex, string cancelButton, string destroyButton, params string[] otherButtons); Task Menu(CancellationToken dismiss, bool userCanDismiss, string? title, string cancelButton, string? destroyButton, params string[] otherButtons); +Task Menu(CancellationToken dismiss, bool userCanDismiss, RectangleF? position, string? title, string description, int defaultActionIndex, string cancelButton, string destroyButton, params string[] otherButtons); ``` cancel and destroy buttons are optional, and are displayed differently on iOS. destroy is in red, cancel is separated from the other buttons. This is the best UI practice, don't try to change it. +`position` helps the menu to display around that rectangle, preferably below/right/above/left in this order. This is useful on tablets and large screens. +You can obtain the position of an interaction using the [Gesture](https://github.com/softlion/XamarinFormsGesture) nuget: + +```csharp +new Command(async args => +{ + var model = (MyItemModel)args!.BindingContext; + var position = args.GetAbsoluteBounds(); + var choice = await UserInteraction.Menu(default, true, position, "title", cancelButton: "cancel", otherButtons: [ "New", "Open" ]); +... +``` + ### Wait indicators with or without progress ```csharp //Displays a wait indicator (title + body + indeterminate progress bar)