Multiwindow with specific size and position #9408
Unanswered
leonardoburchi
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello all,
I'm creating a new application that should work in Windows and MacOS and I'm approaching .NET MAUI to understand if it could be the right solution.
In the application I need to open multiple windows and they should have a specific size, specific position in the screen and should not have borders or title bar.
I found the code below and it works for the size of the window, but I'm not able to figure out how to remove the title bar or position the window in the screen.
Could you please help me?
Thank you
`#if WINDOWS
using Microsoft.UI;
using Microsoft.UI.Windowing;
using Windows.Graphics;
#endif
namespace Scoreboard;
public partial class App : Application
{
public App()
{
InitializeComponent();
#if WINDOWS
var mauiWindow = handler.VirtualView;
var nativeWindow = handler.PlatformView;
nativeWindow.Activate();
IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(nativeWindow);
WindowId windowId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(windowHandle);
AppWindow appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(windowId);
appWindow.Resize(new SizeInt32(500, 500));
#endif
});
}`
Beta Was this translation helpful? Give feedback.
All reactions