2. WPF is a unified programming model for
building richWindows smart client user
experiences that incorporate UI, media, and
documents
3.
4. ExtensibleApplication Markup Language
(XAML)
Controls and Layouts
Data binding
Events, Commands andTriggers
2-D and 3-D graphics
Animation and Media
Styles andTemplates
Documents,Text, and typography
5. XAML or ExtensibleApplication Markup
Language is an XML-based language for
creating and initializing .NET objects
Used inWPF to describes UI
6. XAML C# Object
<MyObject
SomeProperty='1' />
MyObject obj = new MyObject();
obj.SomeProperty = 1;
<MyObject
xmlns='clr-namespace:Samples'
SomeProperty='1' />
using Samples;
MyObject obj = new MyObject();
obj.SomeProperty = 1;
<MyObject
xmlns='clr-
namespace:Samples;assembly=sampl
es.dll'
SomeProperty='1' />
csc /r:samples.dll test.cs
using Samples;
MyObject obj = new MyObject();
obj.SomeProperty = 1;
7. WPF enhancement is the ability to develop an
application using both markup and code-
behind
XAML markup implements the appearance of
an application
Managed programming languages (code-
behind) implements behaviors
Data Binding
Events
Commands
8. Development and maintenance costs are reduced because
appearance-specific markup is not tightly coupled with behavior-
specific code.
Development is more efficient because designers can implement
an application's appearance simultaneously with developers who
are implementing the application's behavior.
Multiple design tools can be used to implement and share XAML
markup, to target the requirements of the application
development contributors; Microsoft Expression Blend provides
an experience that suits designers, while Visual Studio targets
developers.
Globalization and localization forWPF applications is greatly
simplified
9. Elements that provide their own content and behavior
can also be containers of elements
<Button Name="btnSubmit"
Click="btnSubmit_Click"
Width="200" Height="25">Hi
</Button>
<Button Name="btnSubmit"
Click="btnSubmit_Click"
Width="200" Height="200">
<Image Source="MVP.jpg"/>
</Button>
<Button Name="btnSubmit"
Click="btnSubmit_Click"
Width="200" Height="30">
<TextBox
Width="80"></TextBox>
</Button>
Editor's Notes
WPF là một frame xây dựng các ứng dụng Windows kế tiếp cho Windows Form
WPF là một phần của .NET Framework 3.0 và sau đó
Ví dụ về một ứng dụng được viết trên WPF rất đẹp
WPF sử dụng cơ chế hiển thị đồ họa dưới dạng Vector do đó không phụ thuộc vào độ phân giải và tận dụng tối đa khả năng hỗ trợ của phần cứng
Điều này giúp cho việc hiển thị giao diện UI nhanh hơn, hỗ trợ màn hình độ phân giải cao
WPF là sự kết hợp của ngôn ngữ thiết kế giao diện mới XAML
Sự kết hợp của đồ họa 2D GDI+ và 3D DirectX
XAML là một ngôn ngữ thiết kế giao diện mới
Được sử dụng để xây dựng giao diện cho WPF, Silverlight, UWP (Windows 10)
Ngôn ngữ dựa trên cấu trúc XML
Mỗi một thẻ của XAML tương ứng với một Object trong CLR
WPF cho phép xây dựng giao diện theo cả 2 cách
Markup thông qua XAML
Code thông qua khai báo các đối tượng
WPF phân tách phần hiển thị UI và phần logic ứng dụng
Hiển thị thông qua XAML
Logic ứng dụng thông qua code phía sau
2 thành phần UI và Logic liên kết với nhau thông qua
Data Binding
Events
Commands
Chi phí phát triển và bảo trì thấp do việc sửa giao diện không phụ thuộc vào việc sửa logic và ngược lại
Có thể phân tách việc thiết kế và phát triển thành các team riêng rẽ
Hỗ trợ nhiều công cụ thiết kế Expression Blend
Việc bản địa hóa ứng dụng có thể được thực hiện dễ dàng với WPF