Event Bubbling is not working
WWith the following XAML, the the MouseLeftButtonUpButton and MouseLeftButtonDownButton never get called but the MouseEnter and MouseLeave events do get called. Please advise.
TThanks,
Mihcael S. Scherotter
http://mindjetlabs.com
-<Canvas x:Name="button1" Canvas.Top="0" MouseEnter="javascript:MouseEnterButton" MouseLeave="javascript:MouseLeaveButton" Loaded="javascript:ButtonLoaded"> -<Rectangle x:Name="button1_Rectangle" Stroke="#FF8E8E8E" StrokeThickness="0.5" RadiusX="1" RadiusY="1" Opacity="0.0" MouseLeftButtonDown="javascript:MouseLeftButtonDownButton" MouseLeftButtonUp="javascript:MouseLeftButtonUpButton"> -<LinearGradientBrush x:Name="button1_RectangleBrush" StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStopColor="#FFFFFDDC" Offset="0" />
<GradientStopColor="#FFFFD344" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlockFontSize="11" Canvas.Left="3" Canvas.Top="3" x:Name="button1_Text" Text="Button 1" />
</Canvas>
There are a few issues with the above Xaml. First if the Rectangle's opacity is set to zero then WPF/E considers it invisible and doesn't fire any events for it. So you will need to set that to at least 0.1.
However, that won't solve all your problems since the TextBlock sits on top of the Rectangle and will block the mouse events when the cursor is over it. So you will need either put the TextBlock under the rectangle and keep it somewhat transparent so the text comes through or put a semi transparent rectangle on top of the TextBlock and the base Rectangle (like this).