Question: Greetings Gurus,
I am just learning WPF and working through some of the sample projects and tutorials on the web. I have a question:
Why is it necessary to add the event handler in the XAML, when you are adding it to the code behind already? For example, in the current tutorial that I am working through, I am instructed to add the following:
<!-- View report button -->
<Button Grid.Column="1" Grid.Row="3" Margin="0,10,0,0" Width="125"
Height="25" HorizontalAlignment="Right" Click="Button_Click">View</Button>
However, I noticed that if I don't add the "Click=Button_Click" in the XAML and create the click event in the code behind, the application still works as expected. Is it necessary to do both? If so, can you help me to understand why.