示例#1
0
        private static void Show(Adorner adorner, bool retry)
        {
            var adornerLayer = GetAdornerLayer(adorner.AdornedElement);

            if (adornerLayer != null)
            {
                adornerLayer.Remove(adorner);
                adornerLayer.Add(adorner);
                adorner.SetCurrentValue(AdornerLayerProperty, adornerLayer);
            }
            else if (retry)
            {
                // try again later, perhaps giving layout a chance to create the adorner layer
                _ = adorner.Dispatcher.BeginInvoke(
                    DispatcherPriority.Loaded,
                    new DispatcherOperationCallback(ShowAdornerOperation),
                    new object[] { adorner });
            }
        }
        private static void Show(Adorner adorner, bool retry)
        {
            var adornerLayer = GetAdornerLayer(adorner.AdornedElement);

            if (adornerLayer != null)
            {
                adornerLayer.Remove(adorner);
                adornerLayer.Add(adorner);
                adorner.SetCurrentValue(AdornerLayerProperty, adornerLayer);
            }
            else if (retry)
            {
                // try again later, perhaps giving layout a chance to create the adorner layer
#pragma warning disable VSTHRD001 // Avoid legacy thread switching APIs
                _ = adorner.Dispatcher.BeginInvoke(
#pragma warning restore VSTHRD001 // Avoid legacy thread switching APIs
                    DispatcherPriority.Loaded,
                    new DispatcherOperationCallback(ShowAdornerOperation),
                    new object[] { adorner });
            }
        }
示例#3
0
 private void UpdateVisibility()
 {
     _adorner.SetCurrentValue(UIElement.VisibilityProperty, _visible && _adornerLayerVisible ? Visibility.Visible : Visibility.Collapsed);
 }