I want to customiza my TitleView, but I want it to be global, so everytime I create a new Window, the title bar will be custom
I tried this
<Application
x:Class="Demy.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
<!-- Title bar customization -->
<Style TargetType="TitleBar">
<Setter Property="BackgroundColor"
Value="DarkBlue" />
<Setter Property="ButtonBackgroundColor"
Value="Transparent" />
<Setter Property="ButtonForegroundColor"
Value="White" />
<!-- Add more title bar customizations as desired -->
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
in the Application level
Unknown target type 'TitleBar'
public partial class App : Application {
private IHost _host;
public App() {
InitializeComponent();
}
protected override void OnLaunched(LaunchActivatedEventArgs args) {
_host = Host.CreateDefaultBuilder()
.ConfigureServices(ConfigureServices)
.Build();
// Start the host
_host.Start();
// Resolve and activate the main window using dependency injection
var mainWindow = _host.Services.GetRequiredService<NavWindow>();
mainWindow.Activate();
}
private void ConfigureServices(IServiceCollection services) {
// Register your dependencies here
services.AddSingleton<NavWindowViewModel>();
services.AddSingleton(provider => new NavWindow(provider.GetRequiredService<NavWindowViewModel>()));
// Add other services as needed
}
}
}
I want all m windows to have transparent title bar
