Hızlı yanıt: kod örneği
The call to (which is usually called in the default constructor of at least and ) is actually a method call to the partial class of the control (rather than a call up the object hierarchy as I first expected).This method locates a URI to the XAML for the / that is loading, and passes it to the static method. loads the XAML file that is located at the passed in URI, and converts it to an instance of the object that is specified by the root element of the XAML file.In more detail, creates an instance of the , and builds a tree of the XAML. Each node is parsed by the . This gets passed to the class. Some time after this I get a bit lost in how the BAML is converted to objects, but this may be enough to help you on the path to enlightenment.Note: Interestingly, the is a method on the interface, of which / implement in the partial generated class.
InitializeComponent()
Window
UserControl
Window
UserControl
System.Windows.Application.LoadComponent()
LoadComponent()
LoadComponent
XamlParser
XamlParser.ProcessXamlNode()
BamlRecordWriter
InitializeComponent
System.Windows.Markup.IComponentConnector
Window
UserControl