1. What is XAML
XAML can be said to be a special subset of XML, using the same syntax, except that XML can customize any node and attribute, but XAML is limited and can only be used under a defined namespace.
2. Namespace
The limitations of XAML are namespace.
x:class= "Whatisxaml.mainpage" xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x= "http// Schemas.microsoft.com/winfx/2006/xaml "xmlns:local=" Using:whatisxaml "xmlns:d=" http://schemas.microsoft.com/ expression/blend/2008 "xmlns:mc=" http://schemas.openxmlformats.org/markup-compatibility/2006 "mc:ignorable=" D "
The namespace of XAML is actually the same as the namespace in C #, all for qualification. And http://schemas.microsoft.com/winfx/2006/xaml/presentation this similar URL of the namespace actually can not jump, just a simple string, not much meaning. There is no introduction to this at this time, as long as you know not to change the default namespace in general.
3. Default properties, complex properties
The default property is a property that is not declared in the control, such as the Text in Content,textblock in the Button:
< button content = "click Me" /> < button > Click Me</ > < textblock text /> < textblock > 123</ textblock >
A
Complex property is a property, such as Margin,horizontalalignment, that can be simply declared as a string in XAML but which in C # actually declares an object's complex implementation:
<Name= "Clickmebutton" Height= "Max" Width= " Background"= "Red" Margin= "20,20,0,0" HorizontalAlignment= "Left" verticalalignment= "Top" Content = "click me!" />
Button MyButton =NewButton (); Mybutton.height= Max; Mybutton.width= $; Mybutton.margin=NewThickness ( -, -,0,0); Mybutton.background=NewSolidColorBrush (colors.red); Mybutton.content="Click me!"; Mybutton.horizontalalignment=horizontalalignment.left;mybutton.verticalalignment= Verticalalignment.top;
4. TypeConverter
The implementation of complex attributes depends on the TypeConverter.
5. Notes
XAML leverages <!----> comments:
<!-- <button name= "Clickmebutton" height= "width=" background= "Red" margin= "20,20,0,0" horizontalalignment= "left" Verticalalignment= "Top" content= "click me!" click= "Clickmebutton_click"/> --
Original video link:
Uwp-004-what is XAML? Uwp-005-understanding Type convertersuwp-006-understanding Default Properties, Complex properties and the property Ele ment syntaxuwp-007-understanding XAML Schemas and Namespace Declarations
2. XAML