Skip to main content

FluenceWindow

Description​

FluenceWindow derives from WPF Window. It provides custom DWM window chrome, optional content in the title bar, caption button controls, and Fluence theme integration. Its properties below extend the normal WPF window API. For a complete window example, see Basic walkthrough.

Use it as the main window when an app needs Fluence chrome, a custom title bar, or a system backdrop.

FluenceWindow in light mode FluenceWindow in dark mode

Example usage​

Initialize the theme before creating or showing a window. Remove StartupUri from App.xaml when creating the window in OnStartup, as described in Basic walkthrough. SystemBackdropType is a per-window request. The default is Auto; the operating system and current theme determine the available effect.

<fluence:FluenceWindow x:Class="MyApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fluence="http://schemas.fluencewpf.com"
Title="My app"
Width="900"
Height="640"
SystemBackdropType="Auto"
CornerStyle="Round">
<Grid />
</fluence:FluenceWindow>

The FluenceWindow dependency properties add to, rather than replace, inherited Window properties such as Title, Width, Height, ResizeMode, WindowStartupLocation, Owner, and Content. One inherited default is different: ShowActivated starts as false. See Activation on first show.

State and behavior​

FluenceWindow properties​

PropertyDefaultPurpose
SystemBackdropTypeWindowBackdropType.AutoRequests Auto, Mica, Acrylic, Tabbed, or None for this window.
CornerStyleWindowCornerPreference.RoundRequests Default, DoNotRound, Round, or RoundSmall corners. Windows may ignore unsupported requests.
ExtendsContentIntoTitleBarfalseExtends the client area into the title bar region. Set true when supplying a custom title bar.
TitleBarnullOptional UIElement used as custom title-bar content. SetTitleBar(UIElement?) is also available.
TitleBarHeight48 device-independent unitsHeight of the title-bar hit-test region.
ShowIcon, ShowTitletrueControls the standard icon and title display.
IsMinimizeButtonVisible, IsMaximizeButtonVisible, IsCloseButtonVisibleVisibility.VisibleOverrides visibility for the corresponding caption control.
IsMinimizable, IsMaximizable, IsClosabletrueEnables or disables the corresponding caption action.
IsMoveabletrueAllows dragging the window from noninteractive title-bar space.
HasShadowtrueRequests the window shadow.
MarginMaximizedThickness(0)Maximized frame margin used by the custom chrome implementation. Normally leave the system-calculated value alone.

The visibility and capability properties serve different purposes: visibility controls whether a caption button is shown, while the Is*able properties control whether the action is permitted. ResizeMode remains a WPF constraint and can also limit minimize/maximize behavior.

Backdrops and platform behavior​

FluenceWindow uses the theme's NavigationViewContentBackgroundBrush for the NavigationView content layer over Mica. Dark Mica uses its canonical translucent #4C3A3A3A layer on 10-bit displays with advanced color off. The window's backdrop compensation preserves the source header tint. Applications can provide a window-scoped NavigationViewContentBackgroundBrush resource to own that surface.

ApplicationThemeManager.Apply(theme, backdrop) records an application-level backdrop request and raises the manager change event when appropriate. FluenceWindow does not read CurrentBackdrop as a global default: choose the requested effect on each window with SystemBackdropType.

Mica, Acrylic, Tabbed, and rounded-corner requests depend on Windows capabilities. Windows 11 uses DWM system backdrop support where available. On Windows 10, the library uses its documented fallback; high contrast uses an opaque surface. The OS can ignore unsupported corner requests. See Windows and backdrop support.

FluenceWindow begins watching relevant system theme changes when its native window is initialized and updates its chrome accordingly. Call ApplicationThemeManager.Apply before showing windows so Fluence resources are ready.

Activation on first show​

FluenceWindow changes the default of the inherited Window.ShowActivated property to false. The first Show() or ShowDialog() displays the window without activating it. The window then activates itself once its first frame has rendered. This stops a window, such as a dialog, from becoming active while its controls are still being set up. You do not need to defer activation in your own window code.

The window activates itself before it raises ContentRendered, so a ContentRendered handler that looks for the active window, for example to open a ContentDialog, finds this window. After the first frame renders, ShowActivated is true, so later shows and restores activate the window normally. Changing Content later does not activate the window again.

  • A maximized window is always shown activated, because Windows cannot show a maximized window without activating it. ShowActivated reads true while WindowState is Maximized.
  • When the app is launched with a startup show state, such as a shortcut set to run maximized or minimized, the first FluenceWindow shown in the process is shown activated. Windows applies that state only to an activated first show. A normal launch still uses deferred activation.
  • Setting ShowActivated yourself in XAML, code, a style, or a binding turns off the deferred activation. Set it to true to activate the window when it is shown, or to false to keep the window inactive. A style or trigger that sets ShowActivated after the first render also takes effect.
  • Until the first frame renders, IsActive is false and the previously active window stays active. Code that looks for the active window in that time finds the earlier window.

Additional behavior​

FluenceWindow extends Window. SystemBackdropType requests Mica, Acrylic, Tabbed, Auto, or None. Window.Icon is unset by default so WPF can use the consumer application's icon or the Windows default; set it to FluenceWindow.DefaultIcon to opt into Fluence branding. Its TitleBar property accepts a UI element; the TitleBar control raises BackRequested and PaneToggleRequested.

On Windows 11 with Snap layouts enabled, the Maximize and Restore caption glyphs expose Snap hover and perform their window action when clicked. The window handles the caption action on mouse release.

TitleBar​

Description​

TitleBar is a Fluence ContentControl designed for use in a FluenceWindow title-bar region. It renders title metadata, optional back and pane-toggle buttons, header slots, and centered custom content. It does not perform navigation or toggle a navigation pane by itself; connect its command properties or request events to your application behavior.

Use it in a FluenceWindow when the window needs title metadata or application navigation controls.

The window example above shows the title bar within its surrounding window.

Example usage​

Initialize theme resources before creating the window. If startup code creates the window in OnStartup, remove StartupUri from App.xaml; see Basic walkthrough.

Set ExtendsContentIntoTitleBar on the containing window and assign a TitleBar to its TitleBar content property. The window's default title-bar height is 48 device-independent units. TitleBar.IsCompact selects the 32-unit compact layout.

<fluence:FluenceWindow x:Class="MyApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fluence="http://schemas.fluencewpf.com"
Title="My app"
ExtendsContentIntoTitleBar="True">
<fluence:FluenceWindow.TitleBar>
<fluence:TitleBar Title="My app"
Subtitle="Workspace"
IsBackButtonVisible="True"
IsPaneToggleButtonVisible="True"
BackRequested="TitleBar_BackRequested"
PaneToggleRequested="TitleBar_PaneToggleRequested" />
</fluence:FluenceWindow.TitleBar>
<fluence:NavigationView x:Name="AppNavigation">
<fluence:NavigationView.Content>
<Frame x:Name="MainFrame" />
</fluence:NavigationView.Content>
</fluence:NavigationView>
</fluence:FluenceWindow>

The XAML declares MainFrame inside AppNavigation, so the handlers can use the named controls directly. If a request event is used, implement the corresponding application action there. Alternatively, assign BackCommand or PaneToggleCommand and optional command parameters. A command that cannot execute disables its button; the request event is raised after a command executes successfully, or after a click when no command is assigned.

State and behavior​

Property or eventDefaultPurpose
Title, SubtitleEmpty stringText displayed in the title bar.
IconnullObject displayed as the title icon.
IsBackButtonVisiblefalseShows the back button when true.
IsPaneToggleButtonVisiblefalseShows the pane-toggle button when true.
IsCompactfalseUses a 32-unit title bar instead of the standard 48-unit layout.
LeftHeader, RightHeadernullContent slots to the left and right of the central title-bar area.
CustomContentnullContent displayed in the centered slot.
BackCommand, PaneToggleCommandnullCommands invoked by their respective buttons.
BackCommandParameter, PaneToggleCommandParameternullParameters passed to those commands.
BackRequested, PaneToggleRequestedNot applicableEvents for handling button requests in code.

When hosted by FluenceWindow, TitleBar dims its built-in title text, subtitle, glyph buttons, and four content slots while the window is inactive. Each slot's opacity becomes 0.5; hosted child foreground values are left unchanged. Reactivation restores the active title-bar presentation.

Interactive custom content placed in the extended chrome must set WindowChrome.IsHitTestVisibleInChrome="True" so WPF can route pointer input to it. The gallery title bar demonstrates this on its search control. Keep the title bar's content within the available space beside the caption controls.

Additional behavior​

The TitleBar provides LeftHeader and RightHeader slots for custom content. When hosted by FluenceWindow, the right header sits before the actual caption-button area; a standalone TitleBar reserves no caption-button space. TitleBarGlyphButtonStyle is a keyed public resource for buttons in either header whose Content is a Segoe Fluent Icons glyph string.

Reference​

Reference​