PleasantBorder

April 9, 2026 · View on GitHub

A Border subclass with a BackgroundLevel property that maps to one of four themed background elevation levels (BackgroundColor1BackgroundColor4). Useful for building layered card/panel layouts without hardcoding brush keys.

Basic usage

<!-- Level 1 — lightest (window background) -->
<PleasantBorder BackgroundLevel="Level1" CornerRadius="8" Padding="16">
    <TextBlock Text="Level 1" />
</PleasantBorder>

<!-- Level 2 — slightly elevated panel -->
<PleasantBorder BackgroundLevel="Level2" CornerRadius="8" Padding="16">
    <TextBlock Text="Level 2" />
</PleasantBorder>

<!-- Level 3 — card surface -->
<PleasantBorder BackgroundLevel="Level3" CornerRadius="8" Padding="16">
    <TextBlock Text="Level 3" />
</PleasantBorder>

<!-- Level 4 — darkest / most elevated -->
<PleasantBorder BackgroundLevel="Level4" CornerRadius="8" Padding="16">
    <TextBlock Text="Level 4" />
</PleasantBorder>

Properties

PropertyTypeDefaultDescription
BackgroundLevelBackgroundLevelingLevel1Which background color token to use

All standard Border properties (CornerRadius, BorderBrush, BorderThickness, Padding, Child, etc.) are inherited.

BackgroundLeveling values

ValueMaps to
Level1BackgroundColor1 (lightest)
Level2BackgroundColor2
Level3BackgroundColor3
Level4BackgroundColor4 (darkest)

Nested elevation example

<PleasantBorder BackgroundLevel="Level1" CornerRadius="12" Padding="20">
    <StackPanel Spacing="12">
        <TextBlock Text="Window" FontWeight="SemiBold" />
        <PleasantBorder BackgroundLevel="Level2" CornerRadius="8" Padding="16">
            <StackPanel Spacing="8">
                <TextBlock Text="Panel" />
                <PleasantBorder BackgroundLevel="Level3" CornerRadius="6" Padding="12">
                    <TextBlock Text="Card" />
                </PleasantBorder>
            </StackPanel>
        </PleasantBorder>
    </StackPanel>
</PleasantBorder>