Introduction To WPF and MVVM

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 13

Introductions WPF Design Patterns MVVM XAML

To know about the Windows Presentation Foundation that is Microsofts next generation UI framework. How a quite new pattern called MVVM can be used with WPF technology. Then we know the appearance of an user interface in WPF which is specified by XAML.

WPF is one of the core components of the .NET Framework(3.0 and higher), and enables developers to build rich, differentiated Windows client applications. For developing Windows applications. Its Thick client user interface. Using WPF enables you to rapidly build powerful software user interfaces across the Desktop, mobile devices.
3

WPF includes the standard controls youre familiar with, it draws every text, border, and background fill itself. WPF can provide much more powerful features that let you alter any piece of screen content is Rendered. You can use transformation objects to rotate, stretch, scale, and skew anything in your user interface.

WPF separates the appearance of an user interface from its behavior. The appearance is generally specified in the XAML and the behavior is implemented in a managed programming language like C# or Visual Basic. The two parts are tied together by data binding, events and commands. WPF is a powerful new infrastructure based on DirectX
5

Its the software architecture patterns, which is require for the application Maintainability, Extendibility and Testability.
The software architecture patterns contains three items
View(UI) Model(Data displayed in UI) Glue code(Event handling, binding, business logic)

Model-View-ViewModel
Adopting the MVVM pattern with WPF Model(Data Class)
Typical class that covers a database Could be a WCF Service

View(User Interface)
Uses Binding to subscribe to the ViewModel Nothing but Presentation - XAML No or minimal code-behind

ViewModel (VM)
UI binds to this class Informs the View of changes in the data VM consumes services of Model Responds to both the View and the Model

View knows nothing about Model Model knows nothing about View Model knows nothing about View Model View Model knows nothing about View Communication from View to VM is via data binding
Lists for List Boxes and Grids Data for Text Boxes

10

XAML stands for Extensible Application Markup Language. XAML simplifies creating a UI for a .NET Framework application.
When represented as text, XAML files are XML files that generally have the .xaml extension.

11

All you can do in XAML can also be done in code. Advantages of XAML
XAML code is short and clear to read Separation of designer code and logic Clearly separate the roles of designer and developer.

Example

12

Thank You

13

You might also like