ContextMenuContainer 1.3.1
dotnet add package ContextMenuContainer --version 1.3.1
NuGet\Install-Package ContextMenuContainer -Version 1.3.1
<PackageReference Include="ContextMenuContainer" Version="1.3.1" />
<PackageVersion Include="ContextMenuContainer" Version="1.3.1" />
<PackageReference Include="ContextMenuContainer" />
paket add ContextMenuContainer --version 1.3.1
#r "nuget: ContextMenuContainer, 1.3.1"
#addin nuget:?package=ContextMenuContainer&version=1.3.1
#tool nuget:?package=ContextMenuContainer&version=1.3.1
ContextMenuContainer
Native Context Menu for .NET MAUI
Add native context menus to any view in your .NET MAUI application. Supports all major platforms: Windows, Android, iOS, macOS
Platform Preview
iOS | Android | macOS | Windows |
---|---|---|---|
Installation
dotnet add package ContextMenuContainer
Or via NuGet Package Manager.
Setup
- Initialize the component in your
MauiProgram.cs
by adding the extension method:
using APES.MAUI;
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
// Add this line to configure the context menu container
.ConfigureContextMenuContainer();
- Add the namespace to your XAML file:
xmlns:apes="http://apes.ge"
Basic Usage
Wrap any view with the ContextMenuContainer
and define your context menu items:
Inline menu items:
<apes:ContextMenuContainer>
<apes:ContextMenuContainer.MenuItems>
<apes:ContextMenuItem
Text="Copy"
Command="{Binding CopyCommand}"
CommandParameter="{Binding .}" />
<apes:ContextMenuItem
Text="Delete"
Command="{Binding DeleteCommand}"
CommandParameter="{Binding .}"
IsDestructive="True"
Icon="{Binding DeleteIconSource}"/>
</apes:ContextMenuContainer.MenuItems>
<apes:ContextMenuContainer.Content>
<Label Text="Long press or right-click me!"/>
</apes:ContextMenuContainer.Content>
</apes:ContextMenuContainer>
Binding menu items from ViewModel:
<apes:ContextMenuContainer MenuItems="{Binding ContextMenuItems}">
<apes:ContextMenuContainer.Content>
<Frame>
<Image Source="{Binding ImageSource}"/>
</Frame>
</apes:ContextMenuContainer.Content>
</apes:ContextMenuContainer>
ContextMenuItem Properties
Property | Type | Description |
---|---|---|
Text |
string | The text label for the menu item |
Command |
ICommand | Command to execute when the item is tapped |
CommandParameter |
object | Parameter to pass to the command |
IsEnabled |
bool | Whether the item is enabled (default: true) |
IsDestructive |
bool | Marks the item as destructive (red text) |
Icon |
FileImageSource | Icon for the menu item |
Icons
To use icons in your context menu items:
- Add platform-specific image assets to the appropriate folders
- Bind to a
FileImageSource
from your ViewModel
SVG format is recommended for best cross-platform support.
Known Issues
- With Xamarin.Forms when used in a
CollectionView
orListView
item template, there may be conflicts with the collection's own tap/selection events. Consider usingTapGestureRecognizer
directly in these scenarios.
Roadmap
- Configure build scripts
- MAUI migration and support
- Add visibility property
- Add highlight property
- Add support for keyboard shortcuts
- Improve accessibility features
- Add support for submenus and separators
- Add font icon support
- Add comprehensive unit and UI tests
Development & Contribution
Versioning and Releases
This project uses GitVersion for automatic versioning based on Git history and tags.
How to bump version for a new release:
Tag-based versioning: Create a Git tag with the format
v{major}.{minor}.{patch}
to specify the exact versiongit tag v1.2.0 git push origin v1.2.0
Commit message-based versioning: Include specific keywords in your commit message to trigger version increments
- Major version bump:
+semver:breaking
or+semver:major
- Minor version bump:
+semver:feature
or+semver:minor
- Patch version bump:
+semver:fix
or+semver:patch
- Major version bump:
Branch-based versioning: The versioning behavior depends on the branch:
main
branch: Patch increments, creates release versionsdevelop
branch: Minor increments withalpha
suffixrelease/*
branch: No increment withbeta
suffixfeature/*
branch: Inherits version with branch name suffixhotfix/*
branch: Patch increment withbeta
suffix
Contribution Process
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes with appropriate version bump keywords if needed
- Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Support Development
If this plugin saves you development time, please consider supporting its continued improvement:
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-android35.0 is compatible. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net9.0-windows10.0.19041 is compatible. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.Maui.Controls (>= 9.0.80)
-
net9.0-android35.0
- Microsoft.Maui.Controls (>= 9.0.80)
-
net9.0-windows10.0.19041
- Microsoft.Maui.Controls (>= 9.0.80)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on ContextMenuContainer:
Repository | Stars |
---|---|
securefolderfs-community/SecureFolderFS
Powerful, secure, modern way to keep your files protected.
|
Added MAUI targets