PleasantTitleBar
April 9, 2026 ยท View on GitHub
Represents the title bar of a PleasantWindow. Provides standard title bar functionality including window dragging, caption buttons, and title/subtitle display with platform-specific layouts for Windows and macOS.
Usage
The title bar is typically used within a PleasantWindow template:
<chrome:PleasantTitleBar />
Properties
| Property | Type | Default | Description |
|---|---|---|---|
IsTitleVisible | bool | true | Whether the title panel (icon + title + subtitle) is visible |
LeftClearance | double | 40.0 | Width of the reserved left column in the titlebar grid |
Attached properties
| Property | Type | Default | Description |
|---|---|---|---|
IsTitleBarHitTestVisible (attached) | bool | true | Controls whether the drag area responds to hit-testing |
<chrome:PleasantTitleBar IsTitleBarHitTestVisible="False" />
Title bar types
The Type enum (defined on PleasantWindow) controls the title bar layout:
Classic- Regular title barClassicExtended- Slightly larger title bar with more room for custom contentCompact- Compact title bar that takes minimal vertical space
Set on the host window:
window.TitleBarType = PleasantTitleBar.Type.ClassicExtended;
Platform behavior
Windows
- Left clearance column (default 40px) for window menu/hamburger button
- Standard caption buttons on the right
- Drag area for window movement
macOS
- Native traffic light buttons (close, minimize, maximize) in the left column
- Custom caption buttons can be used with
OverrideMacOSCaption - Traffic light area width adjusts based on fullscreen state
Window state pseudo-classes
The control applies pseudo-classes based on window state:
:active- Applied when window is active:minimized- Applied when window is minimized:normal- Applied when window is in normal state:maximized- Applied when window is maximized:isactive- Applied when window is inactive:titlebar- Applied for Classic title bar type
Double-click to maximize
Double-clicking on the drag area toggles maximize/restore (if the window can resize):
// Handled automatically by the control
Custom content
Set custom content in the title bar via the host window:
window.TitleContent = new TextBox { PlaceholderText = "Search..." };
window.LeftTitleBarContent = new Button { Content = "Menu" };
Left clearance
Adjust the left clearance width (Windows only):
<chrome:PleasantTitleBar LeftClearance="0" />
Set to 0 to push the logo/title to the far left when no hamburger menu overlaps the title bar.
Template parts
The control template must provide:
PART_PleasantCaptionButtons- Caption buttons controlPART_CloseMenuItem- Close menu itemPART_ExpandMenuItem- Maximize menu itemPART_ReestablishMenuItem- Restore menu itemPART_CollapseMenuItem- Minimize menu itemPART_DragWindow- Border for window draggingPART_Icon- Icon display panelPART_Title- Title display panelPART_Subtitle- Subtitle text blockPART_LogoPath- Logo path (optional)PART_LeftTitleBarContent- Left content presenterPART_TitleBarContent- Center content presenterPART_TitlePanel- Title stack panelPART_TitleBarGrid- Main layout grid
Notes
- The control automatically subscribes to window property changes and updates the UI
- Drag functionality is built-in via the
PART_DragWindowborder - Platform-specific layouts are applied automatically