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

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:

主站蜘蛛池模板: 江陵县| 太康县| 枞阳县| 凌源市| 北海市| 兴化市| 勐海县| 静乐县| 古交市| 乡城县| 潜山县| 治县。| 道真| 林州市| 谢通门县| 滨海县| 临邑县| 化州市| 会同县| 卓尼县| 山东省| 建水县| 西充县| 探索| 临漳县| 旅游| 荃湾区| 通海县| 黔西县| 岑溪市| 枞阳县| 凌海市| 交口县| 隆德县| 林芝县| 舞钢市| 徐汇区| 泾源县| 台湾省| 博兴县| 咸阳市|