Window position

Jul 19, 2010 at 5:43 PM

Does anyone know how I can control the initial position of a window? I've tried all the normal methods none of which are working.

My goal is to save the x,y location so I can restore the window positions.

Thanks,

Rick

Aug 6, 2010 at 12:28 PM

Hi Rick

I need the same thing. If the windows where placed inside a Canvas instead of a Grid we would be able to solve this by using the horizontal and vertical offset values..

Coordinator
Nov 21, 2010 at 7:58 PM

Dears,

You can save the Windows position over a Grid throught the Margin property. Just save this property and set it on window construction.

Thanks,

Vítor

Nov 25, 2010 at 6:33 PM

Could you show me a small example where this is done?

Nov 26, 2010 at 4:41 PM

I tried setting the margins but could not get it to work.

Rick

Coordinator
Dec 5, 2010 at 7:34 PM

Hi all!

I just tested here: it's need to save and restore the following properties: Width, Height and Margin.

Thanks,

Vítor
Dec 5, 2010 at 10:52 PM

Can you please post some code?

Thanks,

Rick

Coordinator
Jan 18, 2012 at 11:42 PM

Sample to setup margins shift Left=50 and Top=50 from the center:

window.Margin = new Thickness(50, 50, -50, -50)