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

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:

主站蜘蛛池模板: 金堂县| 巢湖市| 昌黎县| 崇仁县| 新巴尔虎右旗| 永康市| 秀山| 札达县| 翁源县| 尤溪县| 微博| 蒙山县| 盖州市| 台北市| 海伦市| 榆树市| 平舆县| 澎湖县| 金寨县| 老河口市| 大石桥市| 衡阳县| 镇巴县| 盘山县| 德昌县| 达日县| 家居| 文成县| 邵阳市| 兴仁县| 三台县| 巧家县| 和政县| 江北区| 宁乡县| 宜春市| 青州市| 陆丰市| 岐山县| 汉阴县| 且末县|