From ae70c2ce93c57124eef26d3d5e21bf9c8cb66c44 Mon Sep 17 00:00:00 2001 From: jkuehner Date: Sun, 30 Jul 2017 11:02:07 +0200 Subject: [PATCH] feature -> possibility to disable mouse over extension --- WpfDesign/Project/Extensions/Extension.cs | 34 +++++++++++++++++-- .../Extensions/MouseOverExtensionServer.cs | 3 ++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/WpfDesign/Project/Extensions/Extension.cs b/WpfDesign/Project/Extensions/Extension.cs index d74ac84..9abb9f0 100644 --- a/WpfDesign/Project/Extensions/Extension.cs +++ b/WpfDesign/Project/Extensions/Extension.cs @@ -60,8 +60,36 @@ namespace ICSharpCode.WpfDesign.Extensions /// Gets or sets a semicolon-separated list with extension names that is disabled for a component's view. /// public static readonly DependencyProperty DisabledExtensionsProperty = - DependencyProperty.RegisterAttached("DisabledExtensions", typeof(string), typeof(Extension), new PropertyMetadata(null)); - - + DependencyProperty.RegisterAttached("DisabledExtensions", typeof(string), typeof(Extension), new PropertyMetadata(null)); + + + + /// + /// Gets the value of the attached property for an object. + /// + /// The object from which the property value is read. + /// The object's property value. + public static bool GetDisableMouseOverExtensions(DependencyObject obj) + { + return (bool)obj.GetValue(DisableMouseOverExtensionsProperty); + } + + /// + /// Sets the value of the attached property for an object. + /// + /// The object to which the attached property is written. + /// The value to set. + public static void SetDisableMouseOverExtensions(DependencyObject obj, bool value) + { + obj.SetValue(DisableMouseOverExtensionsProperty, value); + } + + /// + /// Disables the mouse over Extension for this Element + /// + public static readonly DependencyProperty DisableMouseOverExtensionsProperty = + DependencyProperty.RegisterAttached("DisableMouseOverExtensions", typeof(bool), typeof(Extension), new PropertyMetadata(false)); + + } } diff --git a/WpfDesign/Project/Extensions/MouseOverExtensionServer.cs b/WpfDesign/Project/Extensions/MouseOverExtensionServer.cs index d2b6eb5..e5d13db 100644 --- a/WpfDesign/Project/Extensions/MouseOverExtensionServer.cs +++ b/WpfDesign/Project/Extensions/MouseOverExtensionServer.cs @@ -67,6 +67,9 @@ namespace ICSharpCode.WpfDesign.Extensions if (potentialHitTestTarget is IAdornerLayer) return HitTestFilterBehavior.ContinueSkipSelfAndChildren; + if (Extension.GetDisableMouseOverExtensions(potentialHitTestTarget)) + return HitTestFilterBehavior.ContinueSkipSelfAndChildren; + var item = this.Services.Component.GetDesignItem(potentialHitTestTarget); if (item == null) return HitTestFilterBehavior.ContinueSkipSelf;