You can, for example, subscribe to the window resizing, and set the size of the content manually only when the window “calms down”.
The shortest solution is obtained with Rx extensions (install System.Reactive via nuget ):
<Window x:Class="CustomNC.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Test" Height="350" Width="525"> <Grid Name="ClientArea"> <Grid Name="ContentHolder" HorizontalAlignment="Left" VerticalAlignment="Top"> <!-- тут ваш контент --> </Grid> </Grid> </Window>
and code-behind:
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); Observable.FromEventPattern<SizeChangedEventArgs>(ClientArea, nameof(SizeChanged)) .Throttle(TimeSpan.FromSeconds(0.3)) .ObserveOnDispatcher() .Subscribe(args => { ContentHolder.Width = ClientArea.ActualWidth; ContentHolder.Height = ClientArea.ActualHeight; }); } }
Result:

The same is easy to get with a more prosaic code, without Rx. In XAML, SizeChanged to SizeChanged :
<Grid Name="ClientArea" SizeChanged="OnSizeChanged"> <Grid Name="ContentHolder" HorizontalAlignment="Left" VerticalAlignment="Top"> <!-- тут ваш контент --> </Grid> </Grid>
and in code-behind:
Task currentWaitTask = null; async void OnSizeChanged(object sender, SizeChangedEventArgs e) { var waitTask = Task.Delay(TimeSpan.FromSeconds(0.3)); currentWaitTask = waitTask; await waitTask; if (currentWaitTask != waitTask) return; currentWaitTask = null; ContentHolder.Width = ClientArea.ActualWidth; ContentHolder.Height = ClientArea.ActualHeight; }
Another variation for lovers of unfading classics, with a timer and without TPL:
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); timer.Tick += (o, args) => { ContentHolder.Width = ClientArea.ActualWidth; ContentHolder.Height = ClientArea.ActualHeight; timer.Stop(); }; } DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(0.3) }; void OnSizeChanged(object sender, SizeChangedEventArgs e) { timer.Stop(); timer.Start(); } }