CC.Titlebar
1.0.1
dotnet add package CC.Titlebar --version 1.0.1
NuGet\Install-Package CC.Titlebar -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CC.Titlebar" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CC.Titlebar --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CC.Titlebar, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CC.Titlebar as a Cake Addin #addin nuget:?package=CC.Titlebar&version=1.0.1 // Install CC.Titlebar as a Cake Tool #tool nuget:?package=CC.Titlebar&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Cc.Titlebar
Cc.Titlebar is a leightweight .NET library that provides a customizable titlebar.
How to install
To install this package run the following command in your developer console
dotnet add package Cc.Titlebar
How to use
Usage of the titlebar in the code behind of the main window.
<WindowChrome.WindowChrome>
<WindowChrome
CaptionHeight="32"
GlassFrameThickness="0"
ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
<titlebar:Titlebar Grid.Row="0" DataContext="{Binding TitlebarController}" />
Usage of the titlebar in the code behind of the main window.
public partial class DemoUI : Window
{
public ITitlebarController TitlebarController { get; }
public DemoUI(ITitlebarController titlebarController)
{
// Initialize window
InitializeComponent();
DataContext = this;
// Initialized titlebar controller
TitlebarController = titlebarController;
TitlebarController.WindowStateChangedEvent += SetWindowState;
// Add handler to get window state updates
StateChanged += OnWindowStateChanged;
OnWindowStateChanged();
}
/// <summary>
/// Executed when the window state has changed
/// </summary>
/// <param name="sender">Sender instance</param>
/// <param name="e">Event arguments</param>
private void OnWindowStateChanged(object sender = null, EventArgs e = null)
{
// Update the window state for the titlebar controller
TitlebarController.UpdateWindowState(WindowState);
}
/// <summary>
/// Executed when the window state was set by <see cref="Cc.Titlebar.TitlebarController"/>
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SetWindowState(object sender, WindowState? e)
{
if (e == null)
{
// Close the window if the window state was reported as null
Close();
}
else
{
WindowState = (WindowState)e;
}
}
}
License
This project is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows7.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0-windows7.0
- CommunityToolkit.Mvvm (>= 8.2.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.1 | 121 | 8/18/2024 |