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?
<Window x:Class="WindowPurchaseChaser"
    Title="Purchase Chaser" Height="360" Width="444" Name="WindowPurchaseChaser">
		<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" />

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

Open in new window

Who is Participating?

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

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.

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.

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?


TeDeSmAuthor Commented:
I'm using a mouse. Regarding the code I'll make some changes and check it out.

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



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.
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.