diff --git a/v2rayN/v2rayN.Desktop/Views/MsgView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MsgView.axaml.cs index 9e92fa83..4bb98a44 100644 --- a/v2rayN/v2rayN.Desktop/Views/MsgView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/MsgView.axaml.cs @@ -47,9 +47,14 @@ public partial class MsgView : ReactiveUserControl if (togScrollToEnd.IsChecked ?? true) { txtMsg.ScrollToEnd(); - Dispatcher.UIThread.Invoke(() => - txtMsg.ScrollTo(txtMsg.LineCount, 0, AvaloniaEdit.Rendering.VisualYPosition.TextBottom, txtMsg.Bounds.Height, 0), - DispatcherPriority.Background); + // Let layout finish without a nested dispatcher loop during a native window drag. + Dispatcher.UIThread.Post(() => + { + if (togScrollToEnd.IsChecked ?? true) + { + txtMsg.ScrollTo(txtMsg.LineCount, 0, AvaloniaEdit.Rendering.VisualYPosition.TextBottom, txtMsg.Bounds.Height, 0); + } + }, DispatcherPriority.Background); } }