Alexandria.Client.Infrastructure.RevealWhen.WhenHoverOverParentChanges C# (CSharp) Метод

WhenHoverOverParentChanges() приватный статический Метод

private static WhenHoverOverParentChanges ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
d System.Windows.DependencyObject
e System.Windows.DependencyPropertyChangedEventArgs
Результат void
        private static void WhenHoverOverParentChanges(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var child = d as FrameworkElement;
            if (child == null) return;

            var parent = VisualTreeHelper.GetParent(child) as FrameworkElement;
            if (parent == null) return;

            child.Visibility = Visibility.Hidden;

            parent.MouseEnter += delegate { child.Visibility = Visibility.Visible; };

            parent.MouseLeave += delegate { child.Visibility = Visibility.Hidden; };
        }