Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Customize shell title bar
Customize shell title bar [message #1746844] Sat, 05 November 2016 22:43 Go to next message
Ludger Heisterkamp is currently offline Ludger HeisterkampFriend
Messages: 2
Registered: October 2015
Junior Member
Hello,

many Windows applications are using custom icons or other functions in their title bars (Explorer in Win10, MS Office, ...) . In SWT this is only possible by creating the shell with SWT.NO_TRIM style and drawing your own title bar.
Unfortunately, a NO_TRIM shell is lacking the standard windows features (automatic snapping of windows to left or right of the screen etc.) and I have not found a way to activate this behaviour manually.
Furthermore, a self made title bar takes a lot of work to simulate all the standard functions af a normal title bar (maximize, minimize, resize, move, shell icon, ...)

AFAIK, the standards SWT functions have no access to the title bar itself.
Has anyone an idea how to add the possibility to customize the standard title bar in SWT or by an external library or tool?

Kind regards,
Ludger
Re: Customize shell title bar [message #1836105 is a reply to message #1746844] Mon, 21 December 2020 10:23 Go to previous message
Ben Martin is currently offline Ben MartinFriend
Messages: 1
Registered: December 2020
Junior Member
There are two levels of customization that you can apply to the title bar.

For simple color customization, you can set ApplicationViewTitleBar properties to specify the colors you want to use for title bar elements. In this case, the system retains responsibility for all other aspects of the title bar, such as drawing the app title and defining draggable areas.
Your other option is to hide the default title bar and replace it with your own XAML content. For example, you can place text, buttons, or custom menus in the title bar area. You will also need to use this option to extend an acrylic background into the title bar area.
When you opt for full customization, you are responsible for putting content in the title bar area, and you can define your own draggable region. The system Back, Close, Minimize, and Maximize buttons are still available and handled by the system, but elements like the app title are not. You will need to create those elements yourself as needed by your app.
Simple color customization
If you want only to customize the title bar colors and not do anything too fancy (such as putting tabs in your title bar), you can set the color properties on the ApplicationViewTitleBar for your app window.

This example shows how to get an instance of ApplicationViewTitleBar and set its color properties.

C#

Copy
// using Windows.UI.ViewManagement;

var titleBar = ApplicationView.GetForCurrentView().TitleBar;

// Set active window colors
titleBar.ForegroundColor = Windows.UI.Colors.White;
titleBar.BackgroundColor = Windows.UI.Colors.Green;
titleBar.ButtonForegroundColor = Windows.UI.Colors.White;
titleBar.ButtonBackgroundColor = Windows.UI.Colors.SeaGreen;
titleBar.ButtonHoverForegroundColor = Windows.UI.Colors.White;
titleBar.ButtonHoverBackgroundColor = Windows.UI.Colors.DarkSeaGreen;
titleBar.ButtonPressedForegroundColor = Windows.UI.Colors.Gray;
titleBar.ButtonPressedBackgroundColor = Windows.UI.Colors.LightGreen;

// Set inactive window colors
titleBar.InactiveForegroundColor = Windows.UI.Colors.Gray;
titleBar.InactiveBackgroundColor = Windows.UI.Colors.SeaGreen;
titleBar.ButtonInactiveForegroundColor = Windows.UI.Colors.Gray;
titleBar.ButtonInactiveBackgroundColor = Windows.UI.Colors.SeaGreen;

I hope this information will be helpful to resolve your query!\
Ben Martin
Previous Topic:Input fields that also get set from within the program
Next Topic:MavenCentral SWT for Windows x86_64-3.115.100 missing jar file
Goto Forum:
  


Current Time: Sat Apr 27 02:04:17 GMT 2024

Powered by FUDForum. Page generated in 0.02412 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top