I officially started learning WPF and followed the book Windows Presentation Foundatation unleashed to learn it step by step.
Of course, at the beginning, he learned a new markup language XAML.
Create a simple XAML file first
< Window X: Class = "Mixingxamlwithproceduralcode. window1"
Xmlns = "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "Http://schemas.microsoft.com/winfx/2006/xaml"
Title = "Window1" Height = "366" Width = "646" >
< Grid Height = "294" Width = "579" >
< Button Content = "Test" Height = "23" Horizontalalignment = "Left" Margin =" Name = "Button1" Verticalalignment = "TOP" Width = "75" Click = "Button#click" > </ Button >
< Button X: Name = "Okbutton" Content = "OK" Margin = "60, 40, 0, 0" Width = "78" Height = "20" Flowdirection = "Righttoleft" Horizontalalignment = "Left" Verticalalignment = "Center" Background = "Darkgray" > </ Button >
</ Grid >
</ Window >
Default namespace http://schemas.microsoft.com/winfx/2006/xaml/presentation
The element attributes can be set randomly according to the XML format.
Finally, I have attached some translated terms about the advantages of XAML, which may be more intuitive:
In addition to the advantages of markup language and XML, XAML also has the following advantages:
Designing the UI with XAML is simpler
XAML requires less encoding than other uidesign techniques.
The UI designed by XAML facilitates transfer and submission in other environments. For example, in web or Windows client.
It is very easy to design a dynamic UI with XAML
XAML brings a new revolution to the uidesigner. Now, all designers no longer need the. NET development knowledge to design the UI. In the near future, end users will be able to see more beautiful UIS.