private void AddAdorner(DataBoxRow dataBoxRow) { _currentAdornerEvents?.Dispose(); _currentAdornerEvents = null; var layer = AdornerCanvas.GetAdornerLayer(dataBoxRow); if (layer is null || _itemDetailsAdorner is not null) { return; } _itemDetailsAdorner = new DataBoxItemDetailsAdorner { [AdornerCanvas.AdornedElementProperty] = dataBoxRow, [AdornerCanvas.IsClipEnabledProperty] = false, Row = dataBoxRow }; _currentAdornerEvents = _itemDetailsAdorner.GetObservable(InputElement.IsPointerOverProperty) .Subscribe(_ => CheckIfShouldRemove()); ((ISetLogicalParent)_itemDetailsAdorner).SetParent(dataBoxRow); layer.Children.Add(_itemDetailsAdorner); }
private AdornerCanvas?GetAdornerLayer() { if (AssociatedObject is null) { return(null); } return(AdornerCanvas.GetAdornerLayer(AssociatedObject)); }
private void RemoveAdorner(DataBoxRow dataBoxRow) { _currentAdornerEvents?.Dispose(); _currentAdornerEvents = null; var layer = AdornerCanvas.GetAdornerLayer(dataBoxRow); if (layer is null || _itemDetailsAdorner is null) { return; } layer.Children.Remove(_itemDetailsAdorner); ((ISetLogicalParent)_itemDetailsAdorner).SetParent(null); _itemDetailsAdorner = null; }