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

CanResize="False" not working on Linux #17533

Open
TangDave opened this issue Nov 17, 2024 · 1 comment
Open

CanResize="False" not working on Linux #17533

TangDave opened this issue Nov 17, 2024 · 1 comment
Labels

Comments

@TangDave
Copy link

Describe the bug

Some windows shouldn't be resized - this works fine on Windows, but has no effect on Linux (testing on Ubuntu).

To Reproduce

Create a window for cross-platforms application with CanResize="False".
You'll see that the window can indeed be resized on Linux.

Expected behavior

No response

Avalonia version

11.2.0

OS

Linux

Additional context

No response

@TangDave TangDave added the bug label Nov 17, 2024
@TangDave
Copy link
Author

I'm currently calling the following method at the end of some of my window constructors (just the ones I don't want resizable) to work-around the bug of Avalonia windows being always resizable in Linux:

	public static void PreventResizing(Window window)
	{
		// prevent resizing of window - Avalonia Linux target allows resizing even if "CanResize" is false

		if (Environment.OSVersion.Platform == PlatformID.Unix)
		{
			window.MaxHeight = window.Height;
			window.MaxWidth = window.Width;
			window.MinHeight = window.Height;
			window.MinWidth = window.Width;
		}
		else
			window.CanResize = false;
	}

Why doesn't the Avalonia property "CanResize" take care of this? Why doesn't "CanResize" work on Linux?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant