X and Y options to not work #248

Closed
opened 2026-01-29 16:34:49 +00:00 by claunia · 6 comments
Owner

Originally created by @bsparacino on GitHub (Dec 27, 2018).

Originally assigned to: @GregorBiswanger on GitHub.

I am trying to position the window to the top left corner of the screen 0,0 but the window opens at the default setting, right in the middle of the scree. It appear that the X and Y coordinate options are being ignored.

var mainWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { X = 0, Y = 0 });

Originally created by @bsparacino on GitHub (Dec 27, 2018). Originally assigned to: @GregorBiswanger on GitHub. I am trying to position the window to the top left corner of the screen 0,0 but the window opens at the default setting, right in the middle of the scree. It appear that the X and Y coordinate options are being ignored. `var mainWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { X = 0, Y = 0 });`
claunia added the bug label 2026-01-29 16:34:49 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (Jan 3, 2019):

@bsparacino Okay, that problem is the json serializer in the backend.. we ignore default value handling.. if you instanciate a BrowserWindowOptions object.. all integer properties get a default 0 value.. and then we get a not expected behavior for all applications, that not like a x,y 0 position...

X = 1 and Y = 1 should work...

@GregorBiswanger commented on GitHub (Jan 3, 2019): @bsparacino Okay, that problem is the json serializer in the backend.. we ignore default value handling.. if you instanciate a BrowserWindowOptions object.. all integer properties get a default 0 value.. and then we get a not expected behavior for all applications, that not like a x,y 0 position... X = 1 and Y = 1 should work...
Author
Owner

@GregorBiswanger commented on GitHub (Jan 3, 2019):

@bsparacino mmhh.. on native electron don´t work a absolute 0, 0 position.. I get every time a one pixel distance.. but I implement a solution for the next Electron.NET version.. then you can use you BrowserWindowOptions with X, Y 0 :)

mainWindow.setPosition(0, 0) should eventually work as alternative..

@GregorBiswanger commented on GitHub (Jan 3, 2019): @bsparacino mmhh.. on native electron don´t work a absolute 0, 0 position.. I get every time a one pixel distance.. but I implement a solution for the next Electron.NET version.. then you can use you BrowserWindowOptions with X, Y 0 :) `mainWindow.setPosition(0, 0)` should eventually work as alternative..
Author
Owner

@bsparacino commented on GitHub (Jan 3, 2019):

@GregorBiswanger
Native electron does work with 0,0
Off the top of my head this would be the code
new BrowserWindow({ x: 0, y: 0, frame: false })

My application is with LED boards so it's important to have it line up exactly and not be even 1 pixel off.
Your issue is that you might not be using a frameless window.

Thanks for looking into this!

@bsparacino commented on GitHub (Jan 3, 2019): @GregorBiswanger Native electron does work with 0,0 Off the top of my head this would be the code `new BrowserWindow({ x: 0, y: 0, frame: false })` My application is with LED boards so it's important to have it line up exactly and not be even 1 pixel off. Your issue is that you might not be using a frameless window. Thanks for looking into this!
Author
Owner

@GregorBiswanger commented on GitHub (Jan 3, 2019):

I have this problem with the native Electron API:

https://github.com/electron/electron/issues/4045

@GregorBiswanger commented on GitHub (Jan 3, 2019): I have this problem with the native Electron API: https://github.com/electron/electron/issues/4045
Author
Owner

@GregorBiswanger commented on GitHub (Jan 3, 2019):

Okay, that is a Windows 10/Native Electron problem.. I implement the workaround solution.. the next Electron.NET update have it implemented :)

@GregorBiswanger commented on GitHub (Jan 3, 2019): Okay, that is a Windows 10/Native Electron problem.. I implement the workaround solution.. the next Electron.NET update have it implemented :)
Author
Owner

@GregorBiswanger commented on GitHub (Jan 3, 2019):

fixed

@GregorBiswanger commented on GitHub (Jan 3, 2019): fixed
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#248