Popup window/disabled on containing panel = nullref

Topics: fixed
Dec 23, 2010 at 2:44 PM

Hi, 

I had an issue when displaying a childwindow (same as changing the containing panel to enabled=false)

Just made a quickfix, solved my prob:

add a nullcheck in TooltipService.cs, like so:

 

        private static void OnElementIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var toolTipTimer = elementsAndToolTips[(UIElement)sender].Timer;
            if (toolTipTimer != null)
                if (!(bool)e.NewValue && toolTipTimer.IsEnabled)
                {
                    toolTipTimer.StopAndReset();
                }
        }

Feb 10, 2011 at 9:33 AM

I get a KeyNotFoundException on the same code:

Unhandled exception in SilverlightThe given key was not present in the dictionary.   på System.ThrowHelper.ThrowKeyNotFoundException()   på System.Collections.Generic.Dictionary`2.get_Item(TKey key)   på Silverlight.Controls.ToolTips.ToolTipService.OnElementIsEnabledChanged(Object sender, DependencyPropertyChangedEventArgs e)   på System.Windows.DependencyPropertyChangedEventHandler.Invoke(Object sender, DependencyPropertyChangedEventArgs e)   på System.Windows.Controls.Control.OnIsEnabledChanged(Control control, EventArgs args)   på MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

 

I used:

 

        private static void OnElementIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (!elementsAndToolTips.ContainsKey((UIElement) sender)) return;
            var toolTipTimer = elementsAndToolTips[(UIElement) sender].Timer;
            if (!(bool) e.NewValue && toolTipTimer.IsEnabled)
            {
                toolTipTimer.StopAndReset();
            }
        }

 

 

Feb 13, 2011 at 12:13 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Feb 13, 2011 at 12:14 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.