I want to reposition a uwp app everytime it opens, to bottom left just above the taskbar, to mimic start menu like behavior.
I have tried using AppWindow class to create secondary views and resize and reposition them with the build in methods, but the problem is there is no appwindow instance for the main window.
AppWindow = await AppWindow.TryCreateAsync();
AppWindow.RequestMoveRelativeToDisplayRegion(displayRegion, new Point(xpos, ypos));
AppWindow.RequestSize(new Size(wWidth, wHeight));
In case of ApplicationView for the main window only resizing method is available.
var view = ApplicationView.GetForCurrentView();
view.TryResizeView(new Size(wWidth, wHeight));
So technically I need to do calculations based on display region (monitor) and then place the app on bottom left and also resize it to a specific size depending on monitor effective pixels, resizing isnt the problem as their is a method for it, but moving and repositioning the app window to a specific place on the screen is a problem as there is no method for it.
Thanks.
CodePudding user response:
moving and repositioning the app window to a specific place on the screen is a problem as there is no method for it.
Yes, UWP doesn't have the API that could change its position in the system as mentioned here:UWP Window Placement and How to set UWP app position (x & y coordinates) . Although this is an old question, the answer doesn't change. The position of the UWP window can't be controlled from the app level.