PleasantTrayPopup

April 9, 2026 · View on GitHub

A borderless, transparent, topmost popup window designed for system-tray panels. Provides an optional structured layout with header, status row, content area, and footer — each independently hideable. Auto-dismisses when the window loses focus.

Basic usage

var popup = new PleasantTrayPopup
{
    AppTitle = "My App",
    StatusText = "Connected",
    StatusColor = Brushes.Green,
    Width = 320
};

popup.ShowNearTray();

Structured layout (default)

<PleasantTrayPopup AppTitle="VPN Client"
                   StatusText="Connected"
                   Width="300">
    <PleasantTrayPopup.AppIcon>
        <PathIcon Data="{DynamicResource ShieldRegular}" Width="20" Height="20" />
    </PleasantTrayPopup.AppIcon>
    <PleasantTrayPopup.FooterContent>
        <StackPanel Orientation="Horizontal" Spacing="8" Margin="12 8">
            <Button Content="Disconnect" Theme="{DynamicResource DangerButtonTheme}" />
            <Button Content="Settings" />
        </StackPanel>
    </PleasantTrayPopup.FooterContent>
</PleasantTrayPopup>

Properties

PropertyTypeDefaultDescription
UseStructuredLayoutbooltrueWhen false, uses fully custom Content instead of the structured layout
AppIconobject?Icon in the header (IImage or any control)
AppTitlestring?Application name in the header
StatusColorIBrush?Color of the status indicator dot
StatusTextstring?Status text next to the dot
ShowHeaderbooltrueWhether the header section is visible
ShowCloseButtonbooltrueWhether the × button in the header is visible
StatusItemsIEnumerable<StatusItem>?Key/value pairs shown in the status info row
ShowStatusRowbooltrueWhether the status info row is visible
FooterContentobject?Content placed in the footer area
ShowFooterbooltrueWhether the footer section is visible
PopupCornerRadiusCornerRadius12Corner radius of the popup panel
PopupBackgroundIBrush?Background brush override
PopupBorderBrushIBrush?Border brush override
PopupBorderThicknessThickness1Border thickness
PopupMargindouble10Margin from the screen edge when using ShowNearTray()
AutoDismissOnDeactivatebooltrueAuto-hide when the window loses focus

StatusItem

Key/value pairs shown in the status row:

popup.StatusItems = new[]
{
    new StatusItem("Server", "us-east-1"),
    new StatusItem("Latency", "12 ms"),
    new StatusItem("Protocol", "WireGuard"),
};

// Or use the helper:
popup.StatusItems = PleasantTrayPopup.CreateStatusItems(new[]
{
    ("Server",   "us-east-1"),
    ("Latency",  "12 ms"),
});

Events

EventDescription
DismissedRaised when the popup is hidden or closed

Methods

MethodDescription
ShowNearTray()Positions the popup near the system tray and shows it
Dismiss()Hides the popup and raises Dismissed

Custom layout

Set UseStructuredLayout="False" and provide your own Content:

<PleasantTrayPopup UseStructuredLayout="False" Width="280">
    <Border CornerRadius="12" Padding="16">
        <StackPanel Spacing="12">
            <TextBlock Text="Custom content" FontWeight="SemiBold" />
            <Button Content="Action" />
        </StackPanel>
    </Border>
</PleasantTrayPopup>

Tray icon integration

TrayIcon trayIcon = new TrayIcon();
PleasantTrayPopup? popup = null;

trayIcon.Clicked += (_, _) =>
{
    if (popup is { IsVisible: true })
    {
        popup.Dismiss();
        return;
    }

    popup = new MyTrayPopup();
    popup.Dismissed += (_, _) => popup = null;
    popup.ShowNearTray();
};