Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit RC0 - 'strange' event behaviour on disabled controls
0 replies. Latest Post by Guardian11 on September 26, 2008.
(0)
Guardian11
Member
44 points
10 Posts
09-26-2008 7:37 PM |
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_MouseEnterStackPanel_MouseEnter <- we enter on the panel and the first buttonButton_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 buttonStackPanel_MouseEnterButton_MouseLeaveStackPanel_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 ?