Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
softlion authored Mar 8, 2024
1 parent bca6526 commit 8a5479e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,24 @@ UIAlertController on iOS. MaterialAlertDialog on android.
```csharp
Task<int> Menu(CancellationToken dismiss, bool userCanDismiss, string? title, string description, int defaultActionIndex, string cancelButton, string destroyButton, params string[] otherButtons);
Task<int> Menu(CancellationToken dismiss, bool userCanDismiss, string? title, string cancelButton, string? destroyButton, params string[] otherButtons);
Task<int> 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<PointEventArgs>(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)
Expand Down

0 comments on commit 8a5479e

Please sign in to comment.