Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/anpin/ContextMenuContainer

Native context menu for any Xamarin.Forms or MAUI view
https://github.com/anpin/ContextMenuContainer

context-menu ios maui ui-components uwp xamarin xamarin-forms

Last synced: 30 days ago
JSON representation

Native context menu for any Xamarin.Forms or MAUI view

Awesome Lists containing this project

README

        

# ContextMenuContainer
[![NuGet](https://img.shields.io/nuget/v/ContextMenuContainer.svg?style=flat)](https://www.nuget.org/packages/ContextMenuContainer/)
[![Package nuget](https://github.com/anpin/ContextMenuContainer/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/anpin/ContextMenuContainer/actions/workflows/main.yml)
[![Paypal](https://img.shields.io/badge/Donate%20with-PayPal-blue)](https://paypal.me/APEngineeringLLC?locale.x=en_US)

Native context menu for any MAUI and Xamarin.Forms view.
Supports Windows, Android, iOS and macOS.

iOS | Android | macOs | Windows
:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:
![iOS](img/ios.gif) | ![Android](img/android.gif) | ![Mac](img/macos.gif) | ![UWP](img/uwp.png)
## How to use
1. Add namespace to your XAML file
`xmlns:apes="http://apes.ge"`
2. Add following line of code to your `App.xaml.cs` in order to preserve component during linking and resolve our namespace schema in XAML
```
APES.UI.XF.ContextMenuContainer.Init();
```
3. Extra step for UWP: add our assembly to Xamarin.Forms external assemblies in your UWP `App.xaml.cs`
```
using System.Reflection;
...
var extraAssemblies = new List();
extraAssemblies.Add(typeof(APES.UI.XF.ContextMenuContainer).GetTypeInfo().Assembly);
Xamarin.Forms.Forms.Init(e, extraAssemblies);
```
4. Wrap your view with `ContextMenuContainer`, define your context actions inline or bind from your ViewModel
```
//Inline







//From binding





```

## Icons
Cross-platform icons are really messy at this point, but you can put your assets to the coresponding folder on each platform and then bind to a `FileIconImageSource` from your ViewModel. Please refer to the sample folder for example. SVG is preferable.
## Known issues
- Using it in a `ViewCell` template of `ListView` might lead to issues with recognizing tap/select events from the list itself, so you might consider using TapGestureRecognizer on the template instead

## To-Do
- [x] Configure build scripts
- [ ] Refactor MAUI initialization
- [ ] Add visibility property
- [ ] Add highlight property
- [ ] Add support for shortcuts
- [ ] Add support of accessability features
- [ ] Add support for submenus and separators
- [ ] Add font icons
- [ ] Cover it all with tests

## If this plugin saves you time please consider donating via buttons below, so I can make it even better
[![Paypal](https://img.shields.io/badge/Donate%20with-PayPal-blue)](https://paypal.me/APEngineeringLLC?locale.x=en_US)