views:

545

answers:

2

I ran into the problem where in Silverlight event MouseLeftButtonDown is not being fired for Button and hyperlinkButton. Looks like it is handled somewhere in the framework. How I can override this behavior

In the XAML code below When I click on the button Named Cancel, Button_MouseLeftButtonDown is not fired. I tried putting textblock within the button , MouseLeftButtonDown works when I click on the text on the button, but it is not bubbled up to the Frame

    <Button Name="Cancel" ClickMode="Release" MouseLeftButtonDown="Button_MouseLeftButtonDown">
            <Button.Content>
                <TextBlock Name="CancelInnerText" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown">Clone Page</TextBlock>
            </Button.Content>

A: 

Yeah, I'm not sure what you're going for here. Is this some type of odd situation or are you just looking to have a button that fires an event when you're clicking it?

If its just a normal button you would typically use the default behavior of:

    <Button Name="Cancel" Click="Button_Click">
        <Button.Content>
            <TextBlock>Clone Page</TextBlock>
        </Button.Content>
    </Button>
James Hollister
+1  A: 

Got it to work, had to set the ClickMode="Hover" for the button. Now MouseLeftButtonDown event is firing and also bubbling

Raj