Example #1
0
        public static void Clear([NotNull] FrameworkElement target)
        {
            var layer = AdornerLayer.GetAdornerLayer(target);

            IsSelectedAdorner control;

            if (!CurrentAdorners.TryGetValue(layer, out control))
            {
                return;
            }

            CsGlobal.Wpf.Animation.Opacity(control, 0, new Duration(TimeSpan.FromMilliseconds(150)), null, () => control.OwningLayer.Remove(control));
            CurrentAdorners.Remove(layer);
        }
Example #2
0
        public static void Apply([NotNull] FrameworkElement target)
        {
            var layer = AdornerLayer.GetAdornerLayer(target);
            IsSelectedAdorner control;
            bool available = CurrentAdorners.TryGetValue(layer, out control);

            if (available && Equals(control.AdornedElement, target))
            {
                return;
            }

            if (available)
            {
                CsGlobal.Wpf.Animation.Opacity(control, 0, new Duration(TimeSpan.FromMilliseconds(150)), null, () => control.OwningLayer.Remove(control));
            }
            else
            {
                CurrentAdorners.Add(layer, null);
            }

            CurrentAdorners[layer] = new IsSelectedAdorner(layer, target);
        }