/// <summary> /// This constructor is called from DocumentDesigner's Initialize method. /// </summary> internal ToolStripAdornerWindowService(IServiceProvider serviceProvider, Control windowFrame) { _serviceProvider = serviceProvider; //create the AdornerWindow _toolStripAdornerWindow = new ToolStripAdornerWindow(windowFrame); _behaviorService = (BehaviorService)serviceProvider.GetService(typeof(BehaviorService)); int indexToInsert = _behaviorService.AdornerWindowIndex; //use the adornerWindow as an overlay _overlayService = (IOverlayService)serviceProvider.GetService(typeof(IOverlayService)); if (_overlayService != null) { _overlayService.InsertOverlay(_toolStripAdornerWindow, indexToInsert); } _dropDownAdorner = new Adorner(); int count = _behaviorService.Adorners.Count; // Why this is NEEDED ? To Add the Adorner at proper index in the AdornerCollection for the BehaviorService. So that the DesignerActionGlyph always stays on the Top. if (count > 1) { _behaviorService.Adorners.Insert(count - 1, _dropDownAdorner); } }