WPF Button_click event fires twice

I have one button on a form for which the onclick events fires twice. How do I fix this please?
XAML
<Window x:Class="WindowPurchaseChaser"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Purchase Chaser" Height="360" Width="444" Name="WindowPurchaseChaser">
    <Grid>
		<Label Height="28" Margin="64,13,0,0" Name="lblDateStart" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120" HorizontalContentAlignment="Center">Start Date</Label>
		<Label Height="28" Margin="0,13,55,0" Name="lblDateEnd" VerticalAlignment="Top" HorizontalAlignment="Right" Width="120" HorizontalContentAlignment="Center">End Date</Label>
		<TextBox Height="23" Margin="64,52,0,0" Name="txtbDateStart" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120" IsReadOnly="True"/>
		<TextBox Height="23" HorizontalAlignment="Right" Margin="0,52,55,0" Name="txtbDateEnd" VerticalAlignment="Top" Width="120" />
		<Button Click="btnStart_Click" Margin="178,89,169,0" Name="btnStart" Height="22" VerticalAlignment="Top">Start</Button>
		<TextBox Margin="34,118,37,56" Name="txtProgress" BorderBrush="AliceBlue" />
	</Grid>
</Window>

VB
Private Sub btnStart_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnStart.Click

Open in new window

TeDeSmAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vb_studentCommented:
does this happen on a laptop touchpad or with a normal mouse? i have the same problom on one of my apps. and it was a rare problem. also check the options on the buttons click mode. i belive the default is relesed but that may help. hope this is of use to you.
0
mikebirtCommented:
Hi,

could this be because you're assigning the click handler in Xaml and again in code by adding the 'Handles btnStart.Click' at the end of your handler declaration?

HTH

Mike
0
TeDeSmAuthor Commented:
HI,
I'm using a mouse. Regarding the code I'll make some changes and check it out.
Terry
0
mikebirtCommented:
Hi,

I'd imagine if you remove either the xaml click hander Click="btnStart_Click" or the VB 'Handles...' you'll find the handler will only be invoked once.

good luck, let us know how you get on

HTH

Mike
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TeDeSmAuthor Commented:
Event handler in xaml and vb. Removed the xaml event and all works as expected. Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.