Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XAML - is LayoutRoot mandatory?

When you create a XAML page in Silverlight or WPF, the system creates a top level container called "LayoutRoot". Is there anything special about this name, or can the top level container be called anything (or even nothing)?

like image 527
Craig Schwarze Avatar asked Oct 07 '10 23:10

Craig Schwarze


People also ask

Is XAML a programming language?

XAML is a new descriptive programming language developed by Microsoft to write user interfaces for next-generation managed applications. XAML is the language to build user interfaces for Windows and Mobile applications that use Windows Presentation Foundation (WPF), UWP, and Xamarin Forms.

What is a .XAML file?

A file with the XAML file extension (pronounced as "zammel") is an Extensible Application Markup Language file, created using Microsoft's markup language that goes by the same name. An XAML file may instead use the . XOML file extension. XAML is an XML-based language, so . XAML files are basically just text files.

Why do we use XAML in WPF?

The goal of XAML is to enable visual designers to create user interface elements directly. WPF aims to make it possible to control all visual aspects of the user interface from mark-up.

How does WPF XAML work?

The WPF markup compiler will create a partial class for any compiled XAML file, by deriving a class from the root element type. When you provide code-behind that also defines the same partial class, the resulting code is combined within the same namespace and class of the compiled app.


1 Answers

You can absolutely call it whatever you like. There is nothing special about the LayoutRoot name.

I have to ask though, and I don't mean to seem facetious, did you try removing the name and seeing what happens?

like image 66
Alastair Pitts Avatar answered Oct 09 '22 05:10

Alastair Pitts