下記のようなウィンドウを作成することで、疑似的に解決することができました。
ウィンドウ移動に対する追従が悪い点は改善する必要があります。
xaml
1<Window x:Class="ディスプレイ外に移動するウィンドウテスト.ディスプレイ外に移動するウィンドウ"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6 xmlns:local="clr-namespace:ディスプレイ外に移動するウィンドウテスト"
7 mc:Ignorable="d"
8 Title="ディスプレイ外に移動するウィンドウ"
9 Height="450" Width="800"
10 AllowsTransparency="True"
11 WindowStyle="None"
12 Background="#00000000"
13 MouseDown="Window_MouseDown"
14 MouseUp="Window_MouseUp"
15 MouseMove="Window_MouseMove">
16 <Canvas Background="#00000000">
17 <Border
18 Name="WindowOuter"
19 BorderBrush="Black"
20 BorderThickness="2"
21 Background="White"
22 Height="400"
23 Canvas.Left="180"
24 Canvas.Top="20"
25 Width="300">
26 <Grid Background="White">
27 <Grid.RowDefinitions>
28 <RowDefinition Height="50"/>
29 <RowDefinition/>
30 </Grid.RowDefinitions>
31 <Label
32 VerticalContentAlignment="Center"
33 Content="タイトルバー"
34 Background="#FFA5A5F0"/>
35 <Button
36 Content="✕"
37 FontSize="30"
38 Margin="242,0,0,0"
39 Click="CloseButton_Click"/>
40 <Label
41 Grid.Row="1"
42 FontSize="40"
43 HorizontalContentAlignment="Center"
44 VerticalContentAlignment="Center"
45 Content="Hellow World."/>
46 </Grid>
47 </Border>
48 </Canvas>
49</Window>
C#
1using System.Windows;
2using System.Windows.Controls;
3using System.Windows.Input;
4
5namespace ディスプレイ外に移動するウィンドウテスト
6{
7 /// <summary>
8 /// ディスプレイ外に移動するウィンドウ.xaml の相互作用ロジック
9 /// </summary>
10 public partial class ディスプレイ外に移動するウィンドウ : Window
11 {
12 private const int WindowHeight = 400;
13 private const int WindowWidth = 300;
14 public ディスプレイ外に移動するウィンドウ()
15 {
16 InitializeComponent();
17
18 var screens = System.Windows.Forms.Screen.AllScreens;
19
20 var minPoint = new Point(int.MaxValue, int.MaxValue);
21 var maxPoint = new Point(int.MinValue, int.MinValue);
22 foreach (var screen in screens)
23 {
24 var bound = screen.Bounds;
25 if (minPoint.X > bound.Left ) minPoint.X = bound.Left;
26 if (minPoint.Y > bound.Top ) minPoint.Y = bound.Top;
27 if (maxPoint.X < bound.Right ) maxPoint.X = bound.Right;
28 if (maxPoint.Y < bound.Bottom) maxPoint.Y = bound.Bottom;
29 }
30
31 var newHeight = maxPoint.Y - minPoint.Y;
32 var newWidth = maxPoint.X - minPoint.X;
33
34 this.Left = minPoint.X;
35 this.Top = minPoint.Y;
36 this.Height = newHeight;
37 this.Width = newWidth;
38
39 var primaryBounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
40
41 var left = (primaryBounds.X - minPoint.X) + (primaryBounds.Width - WindowHeight) / 2;
42 var top = (primaryBounds.Y - minPoint.Y) + (primaryBounds.Height - WindowWidth) / 2;
43 WindowOuter.Height = WindowHeight;
44 WindowOuter.Width = WindowWidth;
45 Canvas.SetLeft(WindowOuter, left);
46 Canvas.SetTop (WindowOuter, top);
47 }
48
49 private Point? beforPoint = null;
50
51 private void Window_MouseDown(object sender, MouseButtonEventArgs e)
52 {
53 beforPoint = e.GetPosition(WindowOuter);
54 }
55
56 private void Window_MouseMove(object sender, MouseEventArgs e)
57 {
58 if (!beforPoint.HasValue) return;
59
60 var currentPoint = e.GetPosition(WindowOuter);
61 var pointDiff = new Point(beforPoint.Value.X - currentPoint.X,
62 beforPoint.Value.Y - currentPoint.Y);
63 var nowLeft = Canvas.GetLeft(WindowOuter);
64 var nowTop = Canvas.GetTop(WindowOuter);
65
66 var left = nowLeft - pointDiff.X;
67 var top = nowTop - pointDiff.Y;
68
69 Canvas.SetLeft(WindowOuter, left);
70 Canvas.SetTop (WindowOuter, top);
71 }
72
73 private void Window_MouseUp(object sender, MouseButtonEventArgs e)
74 {
75 beforPoint = null;
76 }
77
78 private void CloseButton_Click(object sender, RoutedEventArgs e)
79 {
80 this.Close();
81 }
82 }
83}