#71 – XAML Files Have A Single Root Element

Each XAML file has exactly one root element, the outermost XAML element.  In WPF, the root element is typically one of:

  • <Page> – A page of content that can be hosted in a browser (System.Windows.Controls.Page)
  • <Window> – A WPF window (System.Windows.Window)
  • <Application> – A WPF application (System.Windows.Application)
  • <ResourceDictionary> – A collection of resources (System.Windows.ResourceDictionary)
  • <UserControl> – A user-defined control (System.Windows.Controls.UserControl)

Root elements also typically include attributes that indicate the namespace(s) used to interpret the content of the XAML file.