Plugin.Maui.PrivacyGlass 1.0.0

dotnet add package Plugin.Maui.PrivacyGlass --version 1.0.0
                    
NuGet\Install-Package Plugin.Maui.PrivacyGlass -Version 1.0.0
                    
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="Plugin.Maui.PrivacyGlass" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Plugin.Maui.PrivacyGlass" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Plugin.Maui.PrivacyGlass" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Plugin.Maui.PrivacyGlass --version 1.0.0
                    
#r "nuget: Plugin.Maui.PrivacyGlass, 1.0.0"
                    
#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.
#:package Plugin.Maui.PrivacyGlass@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Plugin.Maui.PrivacyGlass&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Plugin.Maui.PrivacyGlass&version=1.0.0
                    
Install as a Cake Tool

<p align="center"> <img src="Assets/plugin.maui.privacyglass_128x128.png" /> </p>

Plugin.Maui.PrivacyGlass

NuGet NuGet Downloads Buy Me a Coffee

Plugin.Maui.PrivacyGlass is a lightweight, cross-platform plugin for .NET MAUI that helps you hide sensitive information with a native blur overlay.

Whether you're building banking apps, authentication flows, or secure dashboards, PrivacyGlass gives you a simple way to blur UI elements until the user is authenticated or opts in.

Platforms Supported

Platform Version
.NET MAUI Android API 31+
.NET MAUI iOS iOS 15+
Mac Catalyst 15.0+
Windows 10.0.17763+

Installation

Plugin.Maui.PrivacyGlass is available via NuGet. Get the latest package and install it in your solution:

Install-Package Plugin.Maui.PrivacyGlass

Initialize the plugin in your MauiProgram class:

using Plugin.Maui.PrivacyGlass;

public static MauiApp CreateMauiApp()
{
    var builder = MauiApp.CreateBuilder();

    builder
        .UseMauiApp<App>()
        .ConfigureFonts(fonts =>
        {
            fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
            fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
        })
        .UsePrivacyGlass();

    return builder.Build();
}

Using Plugin.Maui.PrivacyGlass

Including the XAML namespace

To use the plugin in XAML, add the following xmlns to your page or view:

xmlns:privacyglass="clr-namespace:Plugin.Maui.PrivacyGlass.Controls;assembly=Plugin.Maui.PrivacyGlass"

Using the PrivacyGlassView

Wrap the content you want to protect inside a PrivacyGlassView:

<privacyglass:PrivacyGlassView>
    <VerticalStackLayout>
        <Label
            HorizontalOptions="Center"
            HorizontalTextAlignment="Center"
            LineBreakMode="WordWrap"
            FontSize="Medium"
            TextColor="Black"
            Text="Very sensitive information!" />
        <Label
            HorizontalOptions="Center"
            HorizontalTextAlignment="Center"
            LineBreakMode="WordWrap"
            FontSize="Large"
            FontAttributes="Bold"
            TextColor="Red"
            Text="DO NOT SHARE!" />
    </VerticalStackLayout>
</privacyglass:PrivacyGlassView>

Note: PrivacyGlassView protection is not enabled by default.

You can use the IsProtected property to toggle protection on or off:

Unprotected content Content protected
<privacyglass:PrivacyGlassView IsProtected="False"> <privacyglass:PrivacyGlassView IsProtected="True">
<img src="iAssets/mage.png" alt="content not protected" width="805" height="155" /> <img src="Assets/image-1.png" alt="content protected" width="805" height="155" />

If you have multiple instances of the PrivacyGlassView on your page and want to toggle all at once, you can inject the IPrivacyGlass interface into your view and call the TogglePrivacyGlass method to toggle protection on or off.

private readonly IPrivacyGlass _privacyGlass;

public MainPage(IPrivacyGlass privacyGlass)
{
    InitializeComponent();

    _privacyGlass = privacyGlass;
}

private void ShowHideAll_Clicked(object? sender, EventArgs e)
{
    MainThread.BeginInvokeOnMainThread(() =>
    {
        _privacyGlass.TogglePrivacyGlass();
    });
}
Multiple unprotected content Multiple content protected
<img src="Assets/image-2.png" alt="multiple content not protected" width="830" height="345" /> <img src="Assets/image-3.png" alt="multiple content protected" width="830" height="345" />

Imagine you want to protect something behind a paywall or keep content secret until a user action. You can also add KeepScreenOn="True" to the PrivacyGlassView to prevent it from being affected by calls to the TogglePrivacyGlass method from IPrivacyGlass:

<Border
    StrokeThickness="2"
    Stroke="Black"
    StrokeShape="RoundRectangle 20"
    Padding="5">
    <Grid>
        <privacyglass:PrivacyGlassView
            IsProtected="True"
            KeepScreenOn="True">
            
        </privacyglass:PrivacyGlassView>
        <Label
            VerticalOptions="Center"
            HorizontalOptions="Center"
            FontSize="Large"
            Text="Subscribe to unlock!" />
    </Grid>
</Border>

<img src="Assets/image-4.png" alt="super secret protected content" width="410" height="330" />

Sample

Take a look at the PrivacyGlassSample for a detailed implementation of this plugin.

Contributions

Feel free to open an Issue if you find any bugs or want to submit a PR.

License

Plugin.Maui.PrivacyGlass is licensed under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net9.0-android35.0 is compatible.  net9.0-ios18.0 is compatible.  net9.0-maccatalyst18.0 is compatible.  net9.0-windows10.0.19041 is compatible.  net10.0-android was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 176 9/24/2025