我的WPF生成的窗口一旦最大化,除非首先未最大化,否则无法移动到另一个窗口。
我基本上已经删除(并重新添加)了窗口属性中的每个元素,以查看是否会影响它。
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DriverChat"
mc:Ignorable="d"
Title="Geotab Messages"
Height="600"
Width="1080"
Loaded="Window_Loaded"
Icon="Chat.ico"
WindowStyle="SingleBorderWindow"
WindowState="Normal"
WindowStartupLocation="CenterScreen"
Background="#FF363E47"
>
<WindowChrome.WindowChrome>
<WindowChrome
CaptionHeight="0"
ResizeBorderThickness="5"
UseAeroCaptionButtons="False"/>
</WindowChrome.WindowChrome>
<Grid x:Name="windowGrid">
<Grid.RowDefinitions>
<RowDefinition Height="31"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ContentControl x:Name="TitleBar">
<Border
Grid.Row="0"
Background="#FF363E47"
HorizontalAlignment="Stretch"
Height="31"
VerticalAlignment="Top">
<Label
Content="Geotab Messages (BETA)"
FontSize="12"
FontWeight="Normal"
HorizontalContentAlignment="Center"
Margin="47,0"
Padding="5,3"
Foreground="#FFF7F7F7"
HorizontalAlignment="Left"
VerticalContentAlignment="Center"
/>
</Border>
</ContentControl>
<StackPanel Grid.Row="0" Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource Square}" x:Name="btnMin" Content="—" HorizontalAlignment="Right" Width="48" Background="#FF363E47" Foreground="#FFF7F7F7" BorderThickness="0" BorderBrush="Transparent"/>
<Button Style="{StaticResource Square}" x:Name="btnMax" Content="⃞" FontSize="14" HorizontalAlignment="Right" Width="48" Background="#FF363E47" Foreground="#FFF7F7F7" BorderThickness="0" BorderBrush="Transparent" />
<Button Style="{StaticResource Square}" x:Name="btnClose" Content="✕" FontSize="14" HorizontalAlignment="Right" Width="48" Background="#FF363E47" Foreground="#FFF7F7F7" BorderThickness="0" BorderBrush="Transparent"/>
</StackPanel>
解决方案:
在WindowChrome部分中,captionHeight需要更改为非零值,以便用户可以访问。