官术网_书友最值得收藏!

The code behind file of an XAML page

When an XAML is markup compiled, it has an associated code behind class file. The code behind is a partial class and derives from the same class, which is the root of the XAML page element:

    public partial class MainWindow : Window 
    { 
      public MainWindow() 
      { 
        InitializeComponent(); 
      } 
    } 

The constructor of the class gives a call to the InitializeComponent method available in another partial class implementation, which resides in a .g.i.cs file. For example, if your XAML page name is MainWindow.xaml, its associated code behind is MainWindow.xaml.cs and the core partial implementation is in an autogenerated file named MainWindow.g.i.cs. The .g.i.cs file can be located in the obj folder under the project. It loads your XAML page and defines the UI elements placed in the designer.

Here's how the InitializeComponent() method looks like:

主站蜘蛛池模板: 宁河县| 沙河市| 苏州市| 西乌珠穆沁旗| 望江县| 玉田县| 阜平县| 南充市| 荣成市| 建瓯市| 甘南县| 林州市| 沾益县| 溧水县| 灵武市| 册亨县| 绥化市| 株洲市| 星座| 兴国县| 修武县| 南华县| 赫章县| 秀山| 新昌县| 晋宁县| 隆化县| 五寨县| 大兴区| 五指山市| 绿春县| 巴中市| 滕州市| 巫山县| 日土县| 张家界市| 敖汉旗| 东阳市| 呼和浩特市| 密云县| 饶平县|