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 }); } }
private void UpdateVisibility() { _adorner.SetCurrentValue(UIElement.VisibilityProperty, _visible && _adornerLayerVisible ? Visibility.Visible : Visibility.Collapsed); }