Window Drop Shadow with ChromedTitleBar

Themes, Shared, and Core Libraries for Avalonia UI Forum

Posted 4 months ago by Timothy Nunnink
Avatar

When using the ChromedTitleBar the window will no longer show the drop shadow. I'm using this control on a child window as a dialog over a main/root window. Is this because the ChromedTitleBar is configuing the parent window ExtendClientAreaChromeHints to NoChrome? Is there a way to override this or a work around to have a drop shaddow for the child window? Or do I need to not use the ChromedTitleBar and create a custom window style for this?

[Modified 4 months ago]

Comments (3)

Posted 4 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Timothy,

When I run our Avalonia samples app whose main Window uses ChromedTitleBar, I see the Window's drop shadow fine on its outer edges in Windows 11.  On Windows systems, ChromedTitleBar will set these properties on the Window:

window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
window.ExtendClientAreaToDecorationsHint = true;

Which operating system and Avalonia version are you on?

We know that Windows 10 has some issues reported in Avalonia's forums rendering the outer Window shadow.  In our v23.1.1, we updated ChromedTitleBar with a workaround suggested in that thread, with this release note of ours:

Updated ChromedTitleBar to work around an issue in Windows 10 where an outer window border/shadow may not be rendered.

I just tested the latest v23.1.2 version (which had the above workaround) on a Windows 10 machine and it seemed to show a Window shadow ok.


Actipro Software Support

Posted 4 months ago by Timothy Nunnink
Avatar

Interesting. I am running in Windows 11 Pro. I was using v23.1.1 but just upgraded to v23.1.2 and still same results. I also have the sample browser running and am not sure I am seeing it there either. 

Just to be clear, this was for when calling a child window using the window.ShowDialog(this); although I'm not sure that matters or should matter. I have a simple dialog popup window with the ChromedTitleBar and a content control for injecting views. When I comment out the ChromedTitleBar on the popup and run the app, it's clear there is a window drop shaddow, but it's using the system/Windows title bar and chrome. When I uncomment the ChromedTitleBar, the drop shaddow is no longer obvious.

I can send screenshots but I don't see a way to attach files here.

Also, I found an issue on Avalonia repo that seems similar to the one I'm having, but not sure, so maybe it's an Avalonia thing.

Thanks for your help! 

Posted 4 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

You mentioned not seeing the system-rendered drop shadow in our Sample Browser.  Do you see it in our main Window for that app?  I do when I try in Windows 11 Pro.

Or do you mean DO see it in the main Window, but NOT in child windows opened with ShowDialog()?  I tried this in our RootWindow.axaml.cs and did see shadow on that child window too:

protected override void OnKeyDown(KeyEventArgs e) {
	base.OnKeyDown(e);

	var w = new Window() {
		Width = 400,
		Height = 300,
		Title = "Title",
		Content = new StackPanel() {
			Children = {
				new ChromedTitleBar() {
					RightContent = new Button() { Content = "?" }
				},
				new Button() { Content = "Foo" }
			}
		}
	};
	w.ShowDialog(this);
}

Our ChromedTitleBar ends up setting these Window properties behind the scenes:

  • Window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome
  • Window.ExtendClientAreaToDecorationsHint = true
  • Window.ExtendClientAreaTitleBarHeightHint = (height value)

Beyond that, it's just a normal Avalonia control.

If there are problems with the system rendering of the shadow, it's likely something that the Avalonia team would need to address, since all the Win32 code is on their end.  We only modify those three Window properties.

BTW, these forums don't support uploading images at this time.  You can link to images on image share sites though.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.