WPF AKEEL AHMED Overview l WPF l XAML

  • Slides: 14
Download presentation
WPF AKEEL AHMED

WPF AKEEL AHMED

Overview l WPF l XAML Introduction to WPF Layout l

Overview l WPF l XAML Introduction to WPF Layout l

Windows Presentation Foundation o The Windows Presentation Foundation is Microsoft next generation UI framework

Windows Presentation Foundation o The Windows Presentation Foundation is Microsoft next generation UI framework to create applications with a rich user experience. o It is part of the. NET framework 3. 0 and higher. o Its vector based rendering engine uses hardware acceleration of modern graphic cards. o This makes the UI faster, scalable and resolution independent.

WPF Features Separation of Appearance and Behavior o WPF separates the appearance of an

WPF Features Separation of Appearance and Behavior o WPF separates the appearance of an user interface from its behavior. o The appearance is generally specified in the XAML, the behavior is implemented in a managed programming language like C# or Visual Basic. The separation of appearance and behavior brings the following benefits: o Appearance and behaviour are loosely coupled. o Designers and developers can work on separate models. o Graphical design tools can work on simple XML documents instead of parsing code.

WPF Features Rich composition o Controls in WPF are extremely composable. You can define

WPF Features Rich composition o Controls in WPF are extremely composable. You can define almost any type of controls as content of another. o Although these flexibility sounds horrible to designers, its a very powerful feature if you use it appropriate. Put an image into a button to create an image button, or put a list of videos into a combobox to choose a video file.

WPF Features Highly customizable o Because of the strict separation of appearance and behavior

WPF Features Highly customizable o Because of the strict separation of appearance and behavior you can easily change the look of a control. o The concept of styles let you skin controls almost like CSS in HTML. Templates let you replace the entire appearance of a control. The following example shows an default WPF button and a customized button.

Introduction to XAML stands for Extensible Application Markup Language. Its a simple language based

Introduction to XAML stands for Extensible Application Markup Language. Its a simple language based on XML to create and initialize. NET objects with hierarchical relations. o XAML is used to create user interfaces in WPF, Silverlight, declare workflows in WF and for electronic paper in the XPS standard. Advantages of XAML o XAML code is short and clear to read o Separation of designer code and logic Graphical design tools like Expression Blend require XAML as source. o The separation of XAML and UI logic allows it to clearly separate the roles of designer and developer.

XAML vs. Code o As an example we build a simple Stack. Panel with

XAML vs. Code o As an example we build a simple Stack. Panel with a textblock and a button in XAML and compare it to the same code in C#.

Introduction to WPF Layout of controls is critical to an applications usability. o Arranging

Introduction to WPF Layout of controls is critical to an applications usability. o Arranging controls based on fixed pixel coordinates may work for an limited enviroment, but as soon as you want to use it on different screen resolutions or with different font sizes it will fail. o WPF provides a rich set built-in layout panels that help you to avoid the common pitfalls. These are the five most popular layout panels of WPF: o o o Stack Panel Grid Panel Dock Panel Wrap Panel Canvas Panel

WPF Stack. Panel o The Stack. Panel in WPF is a simple and useful

WPF Stack. Panel o The Stack. Panel in WPF is a simple and useful layout panel. It stacks its child elements below or beside each other, dependening on its orientation.

Stack Items horizontally o Horizontal stack panel are can be control by orientation property.

Stack Items horizontally o Horizontal stack panel are can be control by orientation property.

Grid Panel o The grid is a layout panel that arranges its child controls

Grid Panel o The grid is a layout panel that arranges its child controls in a tabular structure of rows and columns. .

Grid Panel o Define Rows and Columns o The grid has one row and

Grid Panel o Define Rows and Columns o The grid has one row and column by default. o To create additional rows and columns, you have to add Row. Definition items to the Row. Definitions collection and Column. Definition items to the Column. Definitions collection.

Grid Panel o Add controls to the grid

Grid Panel o Add controls to the grid