-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Experiment] TitleBar #459
Conversation
Tnx @niels9001 ContextMenu theme is wrong and always light (i can fix this issue, can i make a pr for this?) this code can fix this issues:
|
@niels9001 |
Sure, go ahead - feel free to PR against this branch!
I believe WASDK 1.4 should I address this issue.. let me sync with that team to see if that's correct and we don't need to do any registry stuff? |
This comment was marked as resolved.
This comment was marked as resolved.
IIRC it requires a private API to be used extremely early into the loading process. |
Remove GetAppWindow() and Use Window.AppWindow
UpdateCaptionButtons
…mmunityToolkit/Labs-Windows into niels9001/titlebar-experiment
That's the reason "tall" should be used as soon as there are interactive/input controls. Don't know if it's possible to force this setting, in the logic, based on content? |
This comment was marked as outdated.
This comment was marked as outdated.
@ghost1372 you might want to re-count those pixels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hope we can use this in PowerToys soon 🙂
@ghost1372 oh sorry, now i see those buttons. @niels9001 those should stay untouched. |
@Jay-o-Way Please leave any generic questions/comments in the discussion and not in this PR. |
I have some other stuff that got prioritized. I think in terms of features, we are in a good spot with this PR - or do you see any must-have things that need to be fixed still? I think having some basic tests in place would be good to have - if that's something you want to help out with let me know! |
[DllImport("Shcore.dll", SetLastError = true)] | ||
internal static extern int GetDpiForMonitor(IntPtr hmonitor, Monitor_DPI_Type dpiType, out uint dpiX, out uint dpiY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems silly for a single method, but can use CsWin32 to generate these instead...
Pretty much any tabbed window. Notepad, Explorer, browsers... |
Thank you @Jay-o-Way @AnalogFeelings |
Hi @pratikone Window.ExtendsContentIntoTitleBar + Window.SetTitleBar() |
Both are correct answers because both use same code underneath. The former is for ease of use, latter is more low level and provides finer control . So if you are creating custom drag regions, latter is good too. You can also mix and match APIs. Like setup titlebar using Window APIs and modify drag regions using appwindow APIs. First see if default titlebar is good enough. I've changed default titlebar with winappsdk 1.4 release to represent the most common case : full width custom titlebar |
Is there anything i need to do while hiding the titlebar ? public MainWindow()
{
this.InitializeComponent();
m_AppWindow = this.AppWindow;
m_AppWindow.Changed += AppWindow_Changed;
}
private void AppWindow_Changed(AppWindow sender, AppWindowChangedEventArgs args)
{
if (args.DidPresenterChange)
{
switch (sender.Presenter.Kind)
{
case AppWindowPresenterKind.CompactOverlay:
// Compact overlay - hide custom title bar
// and use the default system title bar instead.
AppTitleBar.Visibility = Visibility.Collapsed;
sender.TitleBar.ResetToDefault();
break;
case AppWindowPresenterKind.FullScreen:
// Full screen - hide the custom title bar
// and the default system title bar.
AppTitleBar.Visibility = Visibility.Collapsed;
sender.TitleBar.ExtendsContentIntoTitleBar = true;
break;
case AppWindowPresenterKind.Overlapped:
// Normal - hide the system title bar
// and use the custom title bar instead.
AppTitleBar.Visibility = Visibility.Visible;
sender.TitleBar.ExtendsContentIntoTitleBar = true;
break;
default:
// Use the default system title bar.
sender.TitleBar.ResetToDefault();
break;
}
}
} because my application is crashing while returning from fullscreen mode to Overlappedmode. (this is not always, but it randomly happens. i'm not able to identify why or when it happens.) |
Hi @insomniachi |
in my case, it'll never call reset to default because I'm only switching between Overlapped/Fullscreen, in that I'm only changing visibility |
So you should set AutoConfigureCustomTitleBar = false when you are switching between Overlapped/Fullscreen If you can please upload a sample so i can test it better. |
reproduceable sample
|
Tnx @insomniachi |
Is it possible to just adjust the pop up margin? |
This is an expected behavior! |
Looks like this is blocking the CI:
Should be clear to merge once this is resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd like to close this PR so that iterations and fixes can be done separately, and so that people can start using the experiment from a package in the Labs feed instead of a PR feed.
The current warning in the CI:
|
Addressing: #454