ContextMenuContainer 1.2.3
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package ContextMenuContainer --version 1.2.3
NuGet\Install-Package ContextMenuContainer -Version 1.2.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ContextMenuContainer" Version="1.2.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ContextMenuContainer --version 1.2.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ContextMenuContainer, 1.2.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ContextMenuContainer as a Cake Addin #addin nuget:?package=ContextMenuContainer&version=1.2.3 // Install ContextMenuContainer as a Cake Tool #tool nuget:?package=ContextMenuContainer&version=1.2.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ContextMenuContainer
Native context menu for any MAUI and Xamarin.Forms view. Supports Windows, Android, iOS and macOS.
iOS | Android | macOs | Windows |
---|---|---|---|
How to use
- Add namespace to your XAML file
xmlns:apes="http://apes.ge"
- 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();
- 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<Assembly>();
extraAssemblies.Add(typeof(APES.UI.XF.ContextMenuContainer).GetTypeInfo().Assembly);
Xamarin.Forms.Forms.Init(e, extraAssemblies);
- Wrap your view with
ContextMenuContainer
, define your context actions inline or bind from your ViewModel
//Inline
<apes:ContextMenuContainer x:Name="ActionsInline">
<apes:ContextMenuContainer.MenuItems>
<apes:ContextMenuItem Text="My action"
Command="{Binding MyCommand}"
CommandParameter="{Binding .}" />
<apes:ContextMenuItem Text="My destructive action"
Command="{Binding MyDestructiveCommand}"
CommandParameter="{Binding .}"
IsDestructive="True"
Icon="{Binding DestructiveIconSource}"/>
</apes:ContextMenuContainer.MenuItems>
<apes:ContextMenuContainer.Content>
<Label Text="Hold me!"/>
</apes:ContextMenuContainer.Content>
</apes:ContextMenuContainer>
//From binding
<apes:ContextMenuContainer x:Name="ContextActionsWithBinding"
MenuItems="{Binding ImageContextItems}">
<apes:ContextMenuContainer.Content>
<Frame>
<Image Source="{Binding IconSource}"/>
</Frame>
</apes:ContextMenuContainer.Content>
</apes:ContextMenuContainer>
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 ofListView
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
- 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
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-android34.0 is compatible. net8.0-browser was computed. net8.0-ios was computed. net8.0-ios17.2 is compatible. net8.0-maccatalyst was computed. net8.0-maccatalyst17.2 is compatible. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows10.0.19041 is compatible. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. monoandroid13.0 is compatible. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap10.0.19041 is compatible. |
Xamarin.iOS | xamarinios was computed. xamarinios10 is compatible. |
Xamarin.Mac | xamarinmac was computed. xamarinmac20 is compatible. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Xamarin.Forms (>= 5.0.0.2622)
-
MonoAndroid 13.0
- Xamarin.AndroidX.AppCompat.AppCompatResources (>= 1.6.1.7)
- Xamarin.AndroidX.Browser (>= 1.5.0.3)
- Xamarin.AndroidX.Lifecycle.LiveData (>= 2.6.1.1)
- Xamarin.AndroidX.MediaRouter (>= 1.6.0.2)
- Xamarin.Forms (>= 5.0.0.2622)
- Xamarin.Google.Android.Material (>= 1.8.0.1)
-
net8.0
- Microsoft.Maui.Controls (>= 8.0.3)
-
net8.0-android34.0
- Microsoft.Maui.Controls (>= 8.0.3)
-
net8.0-ios17.2
- Microsoft.Maui.Controls (>= 8.0.3)
-
net8.0-maccatalyst17.2
- Microsoft.Maui.Controls (>= 8.0.3)
-
net8.0-windows10.0.19041
- Microsoft.Maui.Controls (>= 8.0.3)
-
UAP 10.0.19041
- Microsoft.UI.Xaml (>= 2.7.1)
- Xamarin.Forms (>= 5.0.0.2622)
-
Xamarin.iOS 1.0
- Xamarin.Forms (>= 5.0.0.2622)
-
Xamarin.Mac 2.0
- Xamarin.Forms (>= 5.0.0.2622)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added MAUI targets