Is it possible to set the manual startup location for a WPF window in XAML to start in the Bottom-Right corner of the screen? I can do it in code-behind, but when the window opens, it pops up at the manual location (middle-left of the screen) then it jumps to the bottom right of the screen and it does not look very good.
I can set the location in the Top-Left of the corner in XAML with this coding:
<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>
Can I do the same for the Bottom-Right corner of the screen with XAML coding to fit ANY screen size?
I think it is not possible to set it via xaml. But, You can set it even before the window got loaded that wont jumps from manual location.
public MainWindow()
{
InitializeComponent();
Left = System.Windows.SystemParameters.WorkArea.Width - Width;
Top = System.Windows.SystemParameters.WorkArea.Height - Height;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With