Skip to content
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

AppWindow.ResizeClient() Problems #9563

Open
tingjiangcao opened this issue Apr 19, 2024 · 2 comments
Open

AppWindow.ResizeClient() Problems #9563

tingjiangcao opened this issue Apr 19, 2024 · 2 comments
Labels
area-AppWindow bug Something isn't working team-CompInput Issue for IXP (Composition, Input) team

Comments

@tingjiangcao
Copy link

Describe the bug

Objective:
Customize the title bar and fix the window size to (900, 565)
AppWindow.TitleBar.ExtendsContentIntoTitleBar = true;
AppWindow.ResizeClient(new SizeInt32(900, 565));

Problem 1:
The rendered result is directly (900, 565). But this is the logical size, if the monitor is 150% scaled, the rendering result should be (9001.5, 5651.5)
For this, I had to achieve it in the following way:
var scale = mainPanel.XamlRoot.RasterizationScale;
int width = (int)(950 * scale);
int height = (int)(565* scale);
AppWindow.ResizeClient(new SizeInt32(width, height));

Question 2:
ResizeClient sets the height of the content area, so I need to subtract the height of the title bar.
The document says the height of the title bar is 48, the actual height is 32*1.5=48

Question 3:
If it is a direct AppWindow.Resize (9001.5, 5651.5), then the actual rendered size of the window will be a dozen points smaller in width and height each.

The actual size of the rendered window needs to be viewed in a screenshot. Recommended use of screenshot software snipaste.

My ultimate goal is: immersive title bar, the window specified size is fixed, can not be maximized, can not resize the window, start the position of the center.
Realize the above features, winui3 api is either missing, or off, or bugs. maddening.
My next app will go back to wpf. Or electron.

image

Steps to reproduce the bug

.

Expected behavior

No response

Screenshots

No response

NuGet package version

None

Windows version

No response

Additional context

No response

@tingjiangcao tingjiangcao added the bug Something isn't working label Apr 19, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Apr 19, 2024
Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@NicholasChrzan
Copy link

I'm not sure how this is a bug. The documentation for the AppWindow.ResizeClient clearly states they are in Win32 coordinates which are not the scaled logical coordinates used in XAML, so you'll have to adjust for the DPI of the display. To accomplish what you are after you'll need to manipulate the window style using the win32 SetWindowLong. While it would be nice if these options were included on the AppWindow (or the Window itself) not having them doesn't constitute a bug.

@codendone codendone added area-AppWindow team-CompInput Issue for IXP (Composition, Input) team and removed needs-triage Issue needs to be triaged by the area owners labels Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-AppWindow bug Something isn't working team-CompInput Issue for IXP (Composition, Input) team
Projects
None yet
Development

No branches or pull requests

3 participants