Skip to content

SuGar0218/NativeLikeCaptionButton-WinUI3

Repository files navigation

Native-like Caption Button for WinUI 3

Provides flexible and customizable title bar for WinUI 3 in Windows 11 native UWP style.

image

Features

  • Every caption button can be disabled or hidden.
  • Title bar height can be set freely like many other xaml controls.
  • Supports custom content in title bar.
image image

Drawbacks

  • Does not support Snap Layout on Windows 11.
image

How to use

Remember to set OwnerWindow to ensure it can change the window state properly.

Here is part of the code from the sample app.

<my:NativeLikeTitleBar
    Height="42"
    BackButtonVisibility="{x:Bind ViewModel.IsBackButtonVisible, Converter={StaticResource BoolToVisibilityConverter}}"
    CloseButtonVisibility="{x:Bind ViewModel.IsCloseButtonVisible, Converter={StaticResource BoolToVisibilityConverter}}"
    IsBackButtonEnabled="{x:Bind ViewModel.IsBackButtonEnabled}"
    IsCloseButtonEnabled="{x:Bind ViewModel.IsCloseButtonEnabled}"
    IsMaximizeButtonEnabled="{x:Bind ViewModel.IsMaximizeButtonEnabled}"
    IsMinimizeButtonEnabled="{x:Bind ViewModel.IsMinimizeButtonEnabled}"
    IsPaneToggleButtonEnabled="{x:Bind ViewModel.IsPaneToggleButtonEnabled}"
    MaximizeButtonVisibility="{x:Bind ViewModel.IsMaxmizeButtonVisible, Converter={StaticResource BoolToVisibilityConverter}}"
    MinimizeButtonVisibility="{x:Bind ViewModel.IsMinmizeButtonVisible, Converter={StaticResource BoolToVisibilityConverter}}"
    OwnerWindow="{x:Bind OwnerWindow}"
    PaneToggleButtonClick="TitleBarAreaPaneToggleButtonClick"
    PaneToggleButtonVisibility="{x:Bind ViewModel.IsPaneToggleButtonVisible, Converter={StaticResource BoolToVisibilityConverter}}">

    <my:NativeLikeTitleBar.CustomHeader>
        <!-- Place custom header content here (on the right of back button and pane toggle button) -->
    </my:NativeLikeTitleBar.CustomHeader>

    <my:NativeLikeTitleBar.CustomFooter>
        <!-- Place footer header content here (on the left of caption buttons) -->
    </my:NativeLikeTitleBar.CustomFooter>

    <!-- Place content in the center of title bar here (on the left of caption buttons) -->
</my:NativeLikeTitleBar>

You can also try it in the sample app.

image

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages