protected override void OnContentRendered(EventArgs e)
{
base.OnContentRendered(e);
if (Shown)
{
return;
}
Shown = true;
// make window span over all screens
Rectangle totalSize = Rectangle.Empty;
XOffset = 0;
foreach (Screen screen in Screen.AllScreens)
{
// if bounds smaller 0 the screens are left next to primary screen
if (screen.Bounds.X < 0)
{
if (screen.Bounds.X < XOffset)
{
XOffset = screen.Bounds.X;
}
}
totalSize = Rectangle.Union(totalSize, screen.Bounds);
}
XOffset = Math.Abs(XOffset);
Width = totalSize.Width;
Height = totalSize.Height;
Left = totalSize.Left;
Top = totalSize.Top;
UpdateLayout();
}