示例#1
0
        /// <summary>
        /// Creates a new code completion window.
        /// </summary>
        public CompletionWindow(TextArea textArea) : base(textArea)
        {
            CompletionList = new CompletionList();
            // keep height automatic
            CloseAutomatically = true;
            MaxHeight          = 225;
            Width = 175;
            Child = CompletionList;
            // prevent user from resizing window to 0x0
            MinHeight = 15;
            MinWidth  = 30;

            _toolTipContent = new ContentControl();
            _toolTipContent.Classes.Add("ToolTip");

            _toolTip = new PopupWithCustomPosition
            {
                IsLightDismissEnabled = true,
                PlacementTarget       = this,
                PlacementMode         = PlacementMode.Right,
                Child = _toolTipContent,
            };

            LogicalChildren.Add(_toolTip);

            //_toolTip.Closed += (o, e) => ((Popup)o).Child = null;

            AttachEvents();
        }
        /// <summary>
        /// Creates a new code completion window.
        /// </summary>
        public CompletionWindow(TextArea textArea) : base(textArea, (Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime).MainWindow.PlatformImpl.CreatePopup())
        {
            CompletionList = new CompletionList();
            // keep height automatic
            CloseAutomatically = true;
            MaxHeight          = 225;
            Width   = 175;
            Content = CompletionList;
            // prevent user from resizing window to 0x0
            MinHeight = 15;
            MinWidth  = 30;

            _toolTipContent = new ContentControl();
            _toolTipContent.Classes.Add("ToolTip");

            _toolTip = new PopupWithCustomPosition
            {
                StaysOpen       = false,
                PlacementTarget = this,
                PlacementMode   = PlacementMode.Right,
                Child           = _toolTipContent,
            };

            LogicalChildren.Add(_toolTip);

            //_toolTip.Closed += (o, e) => ((Popup)o).Child = null;

            AttachEvents();
        }
        protected override void OnClosed()
        {
            base.OnClosed();

            if (_toolTip != null)
            {
                _toolTip.IsOpen = false;
                _toolTip        = null;
                _toolTipContent = null;
            }
        }