In Visual Studio 2010 Designer, if you press [F4] while the WPF MainWindow has focus, you get a Properties view. If you click on the Events tab, and then double-click "Loaded", a handler for the window's Loaded event is automatically created in MainWindow.xaml.cs
:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
}
but where is the "wiring" code that attaches this handler to the event?
You will notice that in MainWindow.xaml there is Loaded attribute on window node which points to your event handling method:
<Window ... Loaded="Window_Loaded">
...
</Window>
That is how xaml parser knows what method to wire up
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.