From 2aff85c4e2e903f9962899288dce92d27fda2a4c Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Mon, 28 Jun 2021 23:00:29 +0800 Subject: [PATCH] fixed #882 --- .../HandyControl_Shared/Controls/TabControl/TabItem.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Shared/HandyControl_Shared/Controls/TabControl/TabItem.cs b/src/Shared/HandyControl_Shared/Controls/TabControl/TabItem.cs index 2ca7248ff..68895a1b0 100644 --- a/src/Shared/HandyControl_Shared/Controls/TabControl/TabItem.cs +++ b/src/Shared/HandyControl_Shared/Controls/TabControl/TabItem.cs @@ -225,7 +225,11 @@ public ContextMenu Menu /// private void UpdateItemOffsetX(int oldIndex) { - if (!_isDragging) return; + if (!_isDragging || CurrentIndex >= TabPanel.ItemDic.Count) + { + return; + } + var moveItem = TabPanel.ItemDic[CurrentIndex]; moveItem.CurrentIndex -= CurrentIndex - oldIndex; var offsetX = moveItem.TargetOffsetX;