Position the window on opening

Feb 5, 2010 at 6:45 PM

Hello all,

                  I would like to know if it is possible to position the window in the container right on opening.

I know that it is possible with the horizontal and verticalalignment property but the window can't be moveable when we use those property.

Thanx a lot ...

Coordinator
Feb 6, 2010 at 4:05 PM

Hello,

You can calculate the margin throught whe container width.

Thanks,

 

Vítor

Feb 8, 2010 at 12:59 PM

Thank you but when i use margin i got problem on resize.

Any other solution ? :)

Thanx a lot !

Coordinator
Feb 10, 2010 at 9:51 AM

Carlos,

You must set up margins but remains alignments centered to work with resize. So, you must consider in your margin calculus that the behaviour is centered and you probably need to work with all margins (left and right for horizontal, for example) or set greater values to put the window in the place that you need. You can learn about centered alignements with margins in Exression Blend, in the designer view you can see how the margin values changes in centered alignments.

Vítor

Aug 6, 2010 at 12:34 PM

If you do it this way can you get the windows new location when you drop the window at a new location? Lets say if you e.g. want to store the new window location in Isolated Storage and retreive it the next time you run the program...

Coordinator
Nov 21, 2010 at 7:29 PM

Thesting,

Sorry for late reply.

Absolutely, you can easly save the margins and set it up on window construction.

Thanks,

Vítor

Coordinator
Jan 18, 2012 at 11:41 PM

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

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