Skip to main content

Microsoft Silverlight

Unanswered Question RC0 - 'strange' event behaviour on disabled controlsRSS Feed

(0)

Guardian11
Guardian11

Member

Member

44 points

10 Posts

RC0 - 'strange' event behaviour on disabled controls

 Lets consider this piece of Xaml

<StackPanel MouseEnter="StackPanel_MouseEnter" MouseLeave="StackPanel_MouseLeave">
            <Button Content="test buttn" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" MouseLeftButtonDown="Button_MouseLeftButtonDown" MouseLeftButtonUp="Button_MouseLeftButtonUp"></Button>
            <Button IsEnabled="False" Content="test buttn" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" MouseLeftButtonDown="Button_MouseLeftButtonDown" MouseLeftButtonUp="Button_MouseLeftButtonUp"></Button>
            <Button Content="test buttn" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" MouseLeftButtonDown="Button_MouseLeftButtonDown" MouseLeftButtonUp="Button_MouseLeftButtonUp"></Button>
        </StackPanel>

Basically we have 3 buttons in a StackPanel, the second one is disabled, each event make simple logging of the corresponding function called to the output window of VS.

moving the mouse from top to bottom over all the 3 buttons the sequence we obtain in RC0 is this:

Button_MouseEnter
StackPanel_MouseEnter <- we enter on the panel and the first button
Button_MouseLeave        <- we exit the first button, we are over the second button (disabled)
StackPanel_MouseLeave <- ?!?!?!?!? Over the disabled button the stackpanel fires the mouseleave event ?!?!?!?
Button_MouseEnter         <- we enter and then exit the last button
StackPanel_MouseEnter
Button_MouseLeave
StackPanel_MouseLeave

 In SL2B2 the StackPanel didn't fired the Leave event we were over a disabled control contained in it...

so my question is:

Is this the desired behavior, or is it a side effect caused maybe by some tweaking in the event mechanics ?

Eng. Giorgetti Alessandro
SID s.r.l.
blog: http://www.nablasoft.com/guardian/
e-mail: guardian@nablasoft.com
website: http://www.grupposid.com

Please remember to mark the replies as answers if they helped you and answered your question
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities