コード例 #1
0
    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);
    }
コード例 #2
0
    private AdornerCanvas?GetAdornerLayer()
    {
        if (AssociatedObject is null)
        {
            return(null);
        }

        return(AdornerCanvas.GetAdornerLayer(AssociatedObject));
    }
コード例 #3
0
    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;
    }