我有一个非常简单的窗口,使用以下XAML定义(目前视图模型中没有逻辑):
<Window x:Class="WpfViewer.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:local="clr-namespace:WpfViewer"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MainWindow"
Width="525"
Height="350"
d:DataContext="{d:DesignInstance local:MainWindowVm}"
mc:Ignorable="d">
<Grid Margin="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition Width="8" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="3"
Orientation="Horizontal" Margin="0,0,0,8">
<TextBlock Text="Object" />
<!-- breadcrumbs -->
</StackPanel>
<Border Grid.Row="1"
Grid.Column="0"
BorderBrush="Black"
BorderThickness="1" />
<GridSplitter Grid.Row="1"
Grid.Column="1"
Width="8"
Background="{DynamicResource {x:Static SystemColors.WindowBrush}}"
ResizeBehavior="PreviousAndNext" />
<Border Grid.Row="1"
Grid.Column="2"
BorderBrush="Black"
BorderThickness="1" />
</Grid>
</Window>
当用户调整窗口大小时,新的窗口区域会闪烁成黑色。
![enter image description here](https://istack.dev59.com/Eo9rs.gif)
我不认为这个问题是重复的。它涉及完全定制的窗口,带有动画效果。 防止WPF窗口闪烁