views:

569

answers:

1

I'd like to have a WPF window open in the top right part of the screen.

Right now I can achieve that by opening the window and then moving it (via movewindow in user32.dll). However, this approach means the window opens in it's default location, fully loads, and then moves to the top right.

How could I do I change it so that I could specify the window's initial position and size?

Thanks!!!

+4  A: 

Just set WindowStartupLocation, Height, Width, Left, and Top in xaml:

<Window x:Class="WpfApplication1.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="Window1" 
    Height="500" Width="500"
    WindowStartupLocation="Manual" 
    Left="0" Top="0">
</Window>
Reed Copsey
Thanks!! I knew it had to be simple, but of course I tried to find the complicated solution :).
Evan