private static void ApplyCustomThumbSetting(Thumb thumb)
        {
            var dockItem = thumb.GetVisualAncestors().OfType <DockItem>().FirstOrDefault();

            if (dockItem == null)
            {
                throw new ApplicationException("Cannot find parent DockItem or custom Thumb");
            }

            var enableCustomThumb = thumb.GetValue(IsCustomThumbProperty);

            dockItem._customThumb = enableCustomThumb ? thumb : null;
            dockItem._templateSubscriptions.Disposable = dockItem.SelectAndSubscribeToThumb().Item2;

            if (dockItem._customThumb != null && dockItem._isTemplateThumbWithMouseAfterSeize)
            {
                Dispatcher.UIThread.InvokeAsync(
                    new Action(
                        () =>
                        dockItem._customThumb.RaiseEvent(new PointerPressedEventArgs(PointerPressedEvent)
                {
                    ClickCount  = 0,
                    Device      = MouseDevice.Instance,
                    MouseButton = MouseButton.Left
                })));
            }
        }