[CE U13 C#] Bug? Element selected but not highlighted

Hi experts,

I have a DgnFile linked to other DgnFiles.

I'm trying to programmatically select an item inside a referenced Dgnfile.

It seems that the element is selected (I can see it in “Selection Set number of elements”), but visually the element is not highlighted.

Even if I try to manually force the Hilite on that element, nothing happens.

The same procedure works perfectly on the elements in the main DgnFile.

Here some example code:

class ElementHighlighter : IDisposable
    {
        ElementAgenda elementAgenda_;
        ElementAgendaDisplayable elementAgendaDisplayable_;

        DgnModelRef _dgnModelRef;
        public void SetDgnModel(DgnModelRef dgnModelRef)
        {
            _dgnModelRef = dgnModelRef;
        }

        public enum HighlightCriteria
        {
            SingleHighlight,
            MultipleHighlight,
        };
        private HighlightCriteria highlightCriteria_;

        public ElementHighlighter()
        {
            elementAgenda_ = new ElementAgenda();
            elementAgendaDisplayable_ = new ElementAgendaDisplayable();

            SelectionSetManager.BuildAgenda(ref elementAgenda_);
            highlightCriteria_ = HighlightCriteria.SingleHighlight;
        }
       
        public HighlightCriteria Criteria { get { return highlightCriteria_; } set { highlightCriteria_ = value; } }

        public void Empty()
        {
            SelectionSetManager.EmptyAll();
            elementAgendaDisplayable_.ClearHilite();
            elementAgendaDisplayable_.Empty(true);
        }
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (elementAgenda_ != null)
                {
                    Empty();
                    elementAgenda_.Dispose();
                }
            }
        }

        /// Add an element to our agenda.
        public void AddElement(Bentley.DgnPlatformNET.Elements.Element el)
        {
            if (HighlightCriteria.SingleHighlight == highlightCriteria_)
            {
                Empty();
            }

            var dgnModelref = _dgnModelRef;
            if (dgnModelref is null)
                dgnModelref = el.DgnModelRef;

            var status = SelectionSetManager.AddElement(el, dgnModelref);

            var isActive = SelectionSetManager.IsActive();
            var status2 = SelectionSetManager.ReplaceWithElement(el, dgnModelref);
        }

        /// Remove an element from our agenda so that it is no longer highlighted.
        public void RemoveElement(Bentley.DgnPlatformNET.Elements.Element el)
        {
            el.Invalidate();

            var dgnModelref = _dgnModelRef;
            if (dgnModelref is null)
                dgnModelref = el.DgnModelRef;

            SelectionSetManager.RemoveElement(el, dgnModelref);

        }
    }

Thanks!

Parents Reply Children
No Data