KEMBAR78
Lesson 01 Introduction to WPF | PPTX
WPF is a unified programming model for
building richWindows smart client user
experiences that incorporate UI, media, and
documents
 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
 XAML or ExtensibleApplication Markup
Language is an XML-based language for
creating and initializing .NET objects
 Used inWPF to describes UI
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;
 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
 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
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>
Lesson 01 Introduction to WPF

Lesson 01 Introduction to WPF

  • 2.
    WPF is aunified programming model for building richWindows smart client user experiences that incorporate UI, media, and documents
  • 4.
     ExtensibleApplication MarkupLanguage (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 orExtensibleApplication 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 enhancementis 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 andmaintenance 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 providetheir 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

  • #3 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 đó
  • #4 Ví dụ về một ứng dụng được viết trên WPF rất đẹp
  • #5 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
  • #6 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
  • #7 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
  • #8 Mỗi một thẻ của XAML tương ứng với một Object trong CLR
  • #9 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
  • #10 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
  • #11 Có thể lồng ghép nhiều nội dung vào 1