C# and XAML in WPF – How do they work together?
c#, wpf, xaml
Solution
It seems (please correct me if I'm wrong) that WPF is not really different in the flow of things from winforms. The message pump will call C# event handlers, and the initialization of the form will be done in an `InitializeComponent` method.
The difference is just that the `InitializeComponent` method of a WPF form will include parsing an XAML file, so essentially, the developer is describing the initial appearance of the form using XAML instead of C#.
(Of course "C#" can be interchanged here with "VB".)
Problem
In winforms – there's a message pump waiting for an event to happen – when that happens – the appropriate event handler in C# is called. In WPF there's also XAML. When is that executed? Does the C# code call it or does it call the C# code? In other words: Does an event trigger C# code to run, or does it trigger XAML to be executed?