Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Bug in Button sample from Silverlight.Samples.Controls
2 replies. Latest Post by StephenL on May 18, 2007.
(0)
StephenL
Member
14 points
12 Posts
05-18-2007 10:26 AM |
I am using the button from the sample controls in the SDK ( See http://silverlight.net/GetStarted/ ) and found that for a small button (in my case Width = 25) it incorrectly gets mouse enter events when the mouse is far to the right of the button. Besides being annoying, it causes problems for me since I have the button on top of another control that then doesnt get the events it should. To see the bug add the following two lines to the Page.xaml file of the test app included with the controls. You should see the hand cursor over the entire green rectangle except for when the mouse is directly over the button. Because of the bug you will see the arrow cursor for a big distance to the right of the button as well.
<Rectangle Canvas.Top="30" Width="150" Height="50" Fill="green" Cursor="hand"/><uicontrol:Button Canvas.Top="30" Canvas.Left="0" Text="1" Click="ClickHandler" Width="25"/>
I tried a few fixes on the button code but couldnt figure it out.
Any ideas?
Thanks
Stephen
Vivek Dalvi
458 points
123 Posts
05-18-2007 2:27 PM |
It seems one of the rectangle in button.xaml is not getting resized as part of UpdateLayout. I tried this changes and now it seems to work for me
Declare member variable in button.cs
Rectangle
Add this line in constructor of button
outlinehighlight = FindName(
Update UpdateLayout function as follows...
outlinehighlight.Height = Height;
outlinehighlight.Width = Width;
outlinehighlight.RadiusX = outline.RadiusX;
05-18-2007 3:24 PM |
That did fix it.