Skip to content

Commit 8a5479e

Browse files
authored
Update README.md
1 parent bca6526 commit 8a5479e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,24 @@ UIAlertController on iOS. MaterialAlertDialog on android.
6262
```csharp
6363
Task<int> Menu(CancellationToken dismiss, bool userCanDismiss, string? title, string description, int defaultActionIndex, string cancelButton, string destroyButton, params string[] otherButtons);
6464
Task<int> Menu(CancellationToken dismiss, bool userCanDismiss, string? title, string cancelButton, string? destroyButton, params string[] otherButtons);
65+
Task<int> Menu(CancellationToken dismiss, bool userCanDismiss, RectangleF? position, string? title, string description, int defaultActionIndex, string cancelButton, string destroyButton, params string[] otherButtons);
6566
```
6667
cancel and destroy buttons are optional, and are displayed differently on iOS.
6768
destroy is in red, cancel is separated from the other buttons.
6869
This is the best UI practice, don't try to change it.
6970

71+
`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.
72+
You can obtain the position of an interaction using the [Gesture](https://github.com/softlion/XamarinFormsGesture) nuget:
73+
74+
```csharp
75+
new Command<PointEventArgs>(async args =>
76+
{
77+
var model = (MyItemModel)args!.BindingContext;
78+
var position = args.GetAbsoluteBounds();
79+
var choice = await UserInteraction.Menu(default, true, position, "title", cancelButton: "cancel", otherButtons: [ "New", "Open" ]);
80+
...
81+
```
82+
7083
### Wait indicators with or without progress
7184
```csharp
7285
//Displays a wait indicator (title + body + indeterminate progress bar)

0 commit comments

Comments
 (0)