diff --git a/source/Components/AvalonDock/Controls/LayoutAnchorControl.cs b/source/Components/AvalonDock/Controls/LayoutAnchorControl.cs index 9eb14aca..1199afcb 100644 --- a/source/Components/AvalonDock/Controls/LayoutAnchorControl.cs +++ b/source/Components/AvalonDock/Controls/LayoutAnchorControl.cs @@ -138,7 +138,8 @@ protected override void OnMouseEnter(System.Windows.Input.MouseEventArgs e) { base.OnMouseEnter(e); - if (!e.Handled) + // If the model wants to auto-show itself on hover then initiate the show action + if (!e.Handled && _model.CanShowOnHover) { _openUpTimer = new DispatcherTimer(DispatcherPriority.ApplicationIdle); _openUpTimer.Interval = TimeSpan.FromMilliseconds(400); diff --git a/source/Components/AvalonDock/Layout/LayoutContent.cs b/source/Components/AvalonDock/Layout/LayoutContent.cs index 753cd56a..9e4f6c57 100644 --- a/source/Components/AvalonDock/Layout/LayoutContent.cs +++ b/source/Components/AvalonDock/Layout/LayoutContent.cs @@ -462,6 +462,30 @@ public bool CanFloat #endregion CanFloat + #region CanShowOnHover + + private bool _canShowOnHover = true; + + /// + /// Set to false to disable the behavior of auto-showing + /// a on mouse over. + /// When true, hovering the mouse over an anchorable tab + /// will cause the anchorable to show itself. + /// + /// Defaults to true + public bool CanShowOnHover + { + get => _canShowOnHover; + set + { + if (value == _canShowOnHover) return; + _canShowOnHover = value; + RaisePropertyChanged(nameof(CanShowOnHover)); + } + } + + #endregion CanShowOnHover + #region IsEnabled private bool _isEnabled = true; @@ -531,6 +555,8 @@ public virtual void ReadXml(System.Xml.XmlReader reader) CanFloat = bool.Parse(reader.Value); if (reader.MoveToAttribute(nameof(LastActivationTimeStamp))) LastActivationTimeStamp = DateTime.Parse(reader.Value, CultureInfo.InvariantCulture); + if (reader.MoveToAttribute(nameof(CanShowOnHover))) + CanShowOnHover = bool.Parse(reader.Value); reader.Read(); } @@ -570,6 +596,8 @@ public virtual void WriteXml(System.Xml.XmlWriter writer) if (LastActivationTimeStamp != null) writer.WriteAttributeString(nameof(LastActivationTimeStamp), LastActivationTimeStamp.Value.ToString(CultureInfo.InvariantCulture)); + if (!CanShowOnHover) writer.WriteAttributeString(nameof(CanShowOnHover), CanShowOnHover.ToString()); + if (_previousContainer is ILayoutPaneSerializable paneSerializable) { writer.WriteAttributeString("PreviousContainerId", paneSerializable.Id);