Example #1
0
        /// <summary>Called when the <see cref="P:System.Windows.Controls.ContentControl.Content" /> property changes. </summary>
        /// <param name="oldContent">The old value of the <see cref="P:System.Windows.Controls.ContentControl.Content" /> property.</param>
        /// <param name="newContent">The new value of the <see cref="P:System.Windows.Controls.ContentControl.Content" /> property.</param>
        // Token: 0x0600588F RID: 22671 RVA: 0x00188508 File Offset: 0x00186708
        protected override void OnContentChanged(object oldContent, object newContent)
        {
            PopupControlService popupControlService = PopupControlService.Current;

            if (this == popupControlService.CurrentToolTip && (bool)base.GetValue(PopupControlService.ServiceOwnedProperty) && newContent is ToolTip)
            {
                popupControlService.OnRaiseToolTipClosingEvent(null, EventArgs.Empty);
                popupControlService.OnRaiseToolTipOpeningEvent(null, EventArgs.Empty);
                return;
            }
            base.OnContentChanged(oldContent, newContent);
        }
Example #2
0
        protected override void OnContentChanged(object oldContent, object newContent)
        {
            PopupControlService popupControlService = PopupControlService.Current;

            // Whenever the tooltip for a control is not an instance of a ToolTip, the framework creates a wrapper
            // ToolTip instance. Such a ToolTip is tagged ServiceOwned and its Content property is bound to the
            // ToolTipProperty of the Owner element. So while such a ServiceOwned ToolTip is visible if the
            // ToolTipProperty on the Owner changes to be a real ToolTip instance then it causes a crash
            // complaining that the ServiceOwned ToolTip is wrapping another nested ToolTip. The condition here
            // detects this case and merely dismisses the old ToolTip and displays the new ToolTip instead thus
            // avoiding the use of a wrapper ToolTip.

            if (this == popupControlService.CurrentToolTip &&
                (bool)GetValue(PopupControlService.ServiceOwnedProperty) &&
                newContent is ToolTip)
            {
                popupControlService.OnRaiseToolTipClosingEvent(null, EventArgs.Empty);
                popupControlService.OnRaiseToolTipOpeningEvent(null, EventArgs.Empty);
            }
            else
            {
                base.OnContentChanged(oldContent, newContent);
            }
        }