SlideShare a Scribd company logo
1 of 33
XAML Overview
Markup for WPF and Silverlight
Gaurav Goyal
Janardan Chaudhary
Nimesh Mishra
Sanat Maharjan
IOE Pulchwok Engineering College
WHAT IS XAML?
WHAT IS XAML?
• Stands for eXtensible Application Markup Language
• Declarative markup language for building UI
• Based on XML
• Used to simplify creation of UI for a .NET apps
• Separates presentation (UI) from business logic
• XAML enables a workflow where different parties can
work simultaneously
• The UI and the logic of an application can be
developed using different tools (VS and Blend)
DECLARATIVE UI WITH XAML
• XAML is a completely declarative language
• A declarative language says "what"
• An imperative language says "how"
• XAML describes the behavior and integration of
components (in most cases UI components)
• Cannot describe business logic
HISTORY OF XAML
• Introduced in 2006 with .NET 3.0
• With Windows Presentation Foundation (WPF)
• WPF is "the new way" to create desktop apps
• Successor of Windows Forms
• Silverlight is introduced in 2007
• Under the name WPF/E - WPF Everywhere
• Used JavaScript for back-end
• Windows Runtime (WinRT) introduced in 2011
• Used for Windows Store apps
• Closer to Silverlight than WPF
XAML-RELATED TECHNOLOGIES
• Windows Presentation Foundation - WPF
• The successor of Windows Forms
• Uses XAML to describe the presentation (UI)
• C# / VB.NET for the back-end logic
• Silverlight
• Develop RIA in collaboration with ASP.NET
• Browsers need a Silverlight plugin
• Windows Runtime - WinRT
• Build Windows Store apps in Windows 8
XAML FEATURES
VECTOR GRAPHICS
• All XAML graphics are Direct3D applications
• Direct3D (part of DirectX) is used in graphical
applications where performance is important
• Uses the video card hardware for rendering
• The result: high-quality rich-media UI
• Vector-based graphics allow lossless scaling
• XAML implements a floating-point logical pixel
system and supports 32-bit ARGB color
ANIMATION
• XAML supports time-based animations
• Presentation timers are initialized and managed by
XAML
• Scene changes are coordinated using a storyboard
• Animations can be triggered by external events
• Including user action or events
• Animation can be defined on a per-object basis directly
from the XAML markup
AUDIO AND VIDEO SUPPORT
• XAML can incorporate audio and video into a user
interface
• Audio support in XAML is a thin layer over the existing
functionality in Win32 and WMP
• XAML supports the videos formats that the OS supports
• i.e. if WMP can play a file – XAML can too
• Relationship between video and animation is also
supported
• They are both ways of showing moving images
• Animation can be synchronized with media
STYLES
• In XAML a style is a set of properties applied to the
content used for visual rendering
• Similar to the concept of CSS
• Use them to standardize non-formatting characteristics
• XAML styles have specific features
• Ability to apply different visual effects based on user events
• Styles are created using MS Expression Blend
11
TEMPLATES
• Templates in XAML allow you to fully change the UI of
anything in XAML
• Different templates available within XAML
• ControlTemplate
• Manages the visualization of a control
• ItemsPanelTemplate
• Handles the visualization panel of list control
• DataTemplate and
HierarchicalDataTemplate
• Responsible for the visualization of items in list controls
12
COMMANDS
• Commands are more abstract and loosely-
coupled version of events
• Examples: copy, cut, paste, save, etc.
• XAML support for commands reduces the
amount of code we need to write
• It gives us more flexibility to change the UI without
breaking the back-end logic
• Commands have action, source, target and
binding
13
COMMANDS (2)
• The power of commands:
• XAML defines a number of built-in commands
• Commands have automatic support for input
actions
• Some XAML controls have built-in behavior tied to
various commands
• Commands are intended to do two things:
• Check whether an action is available
• Execute an action
14
OBJECT-BASED DRAWING
• At the lower-level XAML works in terms of shapes,
not in terms of painting pixels
• Shapes are vector-based and are easily scaled
• Developers create shape objects and let XAML
maintain the view in the most optimized way
• XAML provides a number of ready-to-use shape objects
like line, rectangle, ellipse, path, etc.
• Shape objects can be used inside panels and
inside most XAML controls
15
DECLARATIVE VS.
PROGRAMMATICALLY?
Why we need XAML?
DECLARATIVE VS. PROGRAMMATICALLY
• With XAML each element can be done either
declaratively or programmatically
• No difference in the execution or performance
• Instantiating element from the code behind ruins the idea of
XAML
• The same as Windows Forms
• The following two examples are identical
<Button Content="Click me!"/> Button button=new Button();
button.Content="Click me!";
 With XAML  With Code
Behind
DECLARATIVE UI
• When not using XAML with WPF/Silverlight
• Miss the idea of separation of concerns
• Two parties cannot work simultaneously on the same file
• What happens when making object declaratively?
• It is the same as instantiating the element with parameterless
constructor
• All the magic happens in InitializeComponents()
XAML SYNTAX
XAML SYNTAX
• XAML stands for eXtensible Application Markup
Language
• i.e. uses syntax that is actually pure XML
• Very similar to HTML
• Meant to build applications' UI
• Briefly XAML consists of
• Elements
• Properties
• Elements may have properties
ELEMENTS AND ATTRIBUTES
• UI elements have a set of common properties and
functions
• Such as Width, Height, Cursor, and Tag properties
• Declaring an XML element in XAML
• Equivalent to instantiating the object via a parameterless
constructor
• Setting an attribute on the object element
• Equivalent to setting a property with the same name
• Elements and attributes are case sensitive
• The attributes can be enclosed in single quotes (') or
double quotes (")
PROPERTY ELEMENTS
• Not all properties have just a string value
• Some must be set to an instance of an object
• XAML provide syntax for setting complex property
values, called property elements
• Take the form TypeName.PropertyName contained inside an
TypeName element
22
<Ellipse>
<Ellipse.RenderTransform>
<RotateTransform Angle="45" CenterY="60" />
</Ellipse.RenderTransform>
</Ellipse>
A property
element
CONTENT PROPERTIES
• One of the element's properties is default
• Known as content property
• Typically contains the child elements
• Content properties are used without prefix:
23
<Border>
<TextBox Width="300"/>
</Border>
<!-- Explicit equivalent -->
<Border>
<Border.Child>
<TextBox Width="300"/>
</Border.Child>
</Border>
A content
property
A property
element
ATTACHED PROPERTIES
• Attached properties are special kind of properties
• Can be attached to any object
• Not just the one defining the property
• The syntax is the same as setting a normal
property
• The property must be prefixed with the name of the
element defining the property and a dot
24
ATTACHED PROPERTIES (2)
• Attached properties allow common behavior
to be applied to arbitrary elements
• Allow a child item to access a property of its parent
item
• The base of Attached Behavior
• Commonly used attached properties:
• Canvas.Left and Canvas.Right
• Grid.Row, Grid.Column and Grid.Rowspan
25
ATTACHED PROPERTIES – EXAMPLE
• Using the Canvas.Left and Canvas.Top attached
properties to position Ellipses
• The default value is 0
26
<Canvas>
<Ellipse Fill="Green" Width="80" Height="80"/>
<Ellipse Canvas.Left="25" Canvas.Top="25"
Fill="Red" Width="80" Height="80"/>
<Ellipse Canvas.Left="50" Canvas.Top="50"
Fill="Purple" Width="80" Height="80"/>
</Canvas>
<!-- The result is : -->
DEPENDENCY PROPERTIES
• A Dependency Properties are properties that
extend the functionality of a common language
runtime (CLR) property
• Interact with properties directly and never know
that they are implemented as a dependency
property
• The purpose of dependency properties is to
provide a way to compute the value of a
property based on the value of other inputs
DEPENDENCY PROPERTIES (2)
• A Dependency Property can be implemented to
provide
• Self-contained validation
• Default values
• Callbacks that monitor changes to other properties
• Example of Dependency Properties
• Text property of TextBlock
<TextBox Name="TextBoxFrom"/>
<TextBlock Text="{
Binding ElementName=TextBoxFrom, Path=Text}"/>
Gets the Text
from the
TextBox
XAML CONTROLS
• The controls are the smallest components of a XAML
Application
• Every control consists of
• Appearance
• Code-behind
XAML CONTROL
• XAML Controls are typically not directly
responsible for their own appearance
• XAML Controls are all about behavior
• They defer to templates to provide their visuals
XAML CONTROLS (2)
• Controls may use commands to represent
supported operations
• Controls offer properties to provide a means of
modifying either behavior
• Controls raise events when something important
happens
• XAML provides a range of built-in controls
• Most of these correspond to standard Windows control
types
ADVANTAGES OF XAML
• XAML code is short and clear to read
• Separation of designer code and logic
• Graphical design tools like Expression Blend
require XAML as source.
• The separation of XAML and UI logic allows it to
clearly separate the roles of designer and
developer
xaml overview

More Related Content

What's hot

Introduction to API
Introduction to APIIntroduction to API
Introduction to APIrajnishjha29
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to SwaggerKnoldus Inc.
 
Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPressHarshad Mane
 
SOAP-UI The Web service Testing
SOAP-UI The Web service TestingSOAP-UI The Web service Testing
SOAP-UI The Web service TestingGanesh Mandala
 
Node.js - Extending the Programmability of Apigee Edge
Node.js - Extending the Programmability of Apigee Edge Node.js - Extending the Programmability of Apigee Edge
Node.js - Extending the Programmability of Apigee Edge Apigee | Google Cloud
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentationBhavin Shah
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web ComponentsFu Cheng
 
MVC Seminar Presantation
MVC Seminar PresantationMVC Seminar Presantation
MVC Seminar PresantationAbhishek Yadav
 
What is an Application programming interface(API)?
What is an Application programming interface(API)?What is an Application programming interface(API)?
What is an Application programming interface(API)?Akmal Ali
 
Introduction to Web Development
Introduction to Web DevelopmentIntroduction to Web Development
Introduction to Web DevelopmentParvez Mahbub
 
Android & iPhone App Testing
 Android & iPhone App Testing Android & iPhone App Testing
Android & iPhone App TestingSWAAM Tech
 
Authentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCAuthentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCMindfire Solutions
 
MVVM with WPF
MVVM with WPFMVVM with WPF
MVVM with WPFS V
 

What's hot (20)

Introduction to API
Introduction to APIIntroduction to API
Introduction to API
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to Swagger
 
Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPress
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
 
SOAP-UI The Web service Testing
SOAP-UI The Web service TestingSOAP-UI The Web service Testing
SOAP-UI The Web service Testing
 
ASP.MVC Training
ASP.MVC TrainingASP.MVC Training
ASP.MVC Training
 
Node.js - Extending the Programmability of Apigee Edge
Node.js - Extending the Programmability of Apigee Edge Node.js - Extending the Programmability of Apigee Edge
Node.js - Extending the Programmability of Apigee Edge
 
MVVM
MVVMMVVM
MVVM
 
Web Design Trends: 2018 Edition
Web Design Trends: 2018 EditionWeb Design Trends: 2018 Edition
Web Design Trends: 2018 Edition
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web Components
 
MVC Seminar Presantation
MVC Seminar PresantationMVC Seminar Presantation
MVC Seminar Presantation
 
What is an Application programming interface(API)?
What is an Application programming interface(API)?What is an Application programming interface(API)?
What is an Application programming interface(API)?
 
Introduction to Web Development
Introduction to Web DevelopmentIntroduction to Web Development
Introduction to Web Development
 
Android & iPhone App Testing
 Android & iPhone App Testing Android & iPhone App Testing
Android & iPhone App Testing
 
Authentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCAuthentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVC
 
MVVM with WPF
MVVM with WPFMVVM with WPF
MVVM with WPF
 
Android MVVM
Android MVVMAndroid MVVM
Android MVVM
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 

Viewers also liked

Presentation wpf
Presentation wpfPresentation wpf
Presentation wpfdanishrafiq
 
2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil Mughal2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil MughalAdil Mughal
 
Introduction To Xaml
Introduction To XamlIntroduction To Xaml
Introduction To Xamlphoooo
 
WCF Security, FSec
WCF Security, FSecWCF Security, FSec
WCF Security, FSecAnte Gulam
 
WPF (Windows Presentation Foundation Unit 01)
WPF (Windows Presentation Foundation Unit 01)WPF (Windows Presentation Foundation Unit 01)
WPF (Windows Presentation Foundation Unit 01)Prashanth Shivakumar
 
WPF For Beginners - Learn in 3 days
WPF For Beginners  - Learn in 3 daysWPF For Beginners  - Learn in 3 days
WPF For Beginners - Learn in 3 daysUdaya Kumar
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial Jm Ramos
 

Viewers also liked (10)

Introduction to wpf
Introduction to wpfIntroduction to wpf
Introduction to wpf
 
Presentation wpf
Presentation wpfPresentation wpf
Presentation wpf
 
WPF Basics
WPF BasicsWPF Basics
WPF Basics
 
2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil Mughal2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil Mughal
 
Introduction To Xaml
Introduction To XamlIntroduction To Xaml
Introduction To Xaml
 
WCF Security, FSec
WCF Security, FSecWCF Security, FSec
WCF Security, FSec
 
WPF (Windows Presentation Foundation Unit 01)
WPF (Windows Presentation Foundation Unit 01)WPF (Windows Presentation Foundation Unit 01)
WPF (Windows Presentation Foundation Unit 01)
 
WPF For Beginners - Learn in 3 days
WPF For Beginners  - Learn in 3 daysWPF For Beginners  - Learn in 3 days
WPF For Beginners - Learn in 3 days
 
C# basics
 C# basics C# basics
C# basics
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 

Similar to xaml overview

Wpf-Xaml And Layout Basics
Wpf-Xaml And Layout BasicsWpf-Xaml And Layout Basics
Wpf-Xaml And Layout BasicsRobin Aggarwal
 
MSTC'14 (Window Phone +Windows 8 ) Workshops_Day 5
MSTC'14 (Window Phone +Windows 8 ) Workshops_Day 5MSTC'14 (Window Phone +Windows 8 ) Workshops_Day 5
MSTC'14 (Window Phone +Windows 8 ) Workshops_Day 5Amira Gamal
 
Getting started with Xamarin forms
Getting started with Xamarin formsGetting started with Xamarin forms
Getting started with Xamarin formsSolTech, Inc.
 
Web Atoms - More Markup - Less Script
Web Atoms - More Markup - Less ScriptWeb Atoms - More Markup - Less Script
Web Atoms - More Markup - Less ScriptAkash Kava
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScriptAndres Baravalle
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friendWebcomponents are your frameworks best friend
Webcomponents are your frameworks best friendFilip Bruun Bech-Larsen
 
Ballerina- A programming language for the networked world
Ballerina- A programming language for the networked worldBallerina- A programming language for the networked world
Ballerina- A programming language for the networked worldIntegration Meetups
 
Ballerina- A programming language for the networked world
Ballerina- A programming language for the networked worldBallerina- A programming language for the networked world
Ballerina- A programming language for the networked worldAsangi Jasenthuliyana
 
AlgorithmVisualiserProject_TanuJaiswal.pdf
AlgorithmVisualiserProject_TanuJaiswal.pdfAlgorithmVisualiserProject_TanuJaiswal.pdf
AlgorithmVisualiserProject_TanuJaiswal.pdfTanu Jaiswal
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayLuka Zakrajšek
 
Web programming and services
Web programming and servicesWeb programming and services
Web programming and serviceslaibamaqsood
 
Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1Salesforce Developers
 
Flex introduction
Flex introductionFlex introduction
Flex introductioniamprajyot
 

Similar to xaml overview (20)

SilverlightDevIntro
SilverlightDevIntroSilverlightDevIntro
SilverlightDevIntro
 
Wpf-Xaml And Layout Basics
Wpf-Xaml And Layout BasicsWpf-Xaml And Layout Basics
Wpf-Xaml And Layout Basics
 
Actors evolved- Rotem Hermon
Actors evolved- Rotem HermonActors evolved- Rotem Hermon
Actors evolved- Rotem Hermon
 
MSTC'14 (Window Phone +Windows 8 ) Workshops_Day 5
MSTC'14 (Window Phone +Windows 8 ) Workshops_Day 5MSTC'14 (Window Phone +Windows 8 ) Workshops_Day 5
MSTC'14 (Window Phone +Windows 8 ) Workshops_Day 5
 
Getting started with Xamarin forms
Getting started with Xamarin formsGetting started with Xamarin forms
Getting started with Xamarin forms
 
Web Atoms - More Markup - Less Script
Web Atoms - More Markup - Less ScriptWeb Atoms - More Markup - Less Script
Web Atoms - More Markup - Less Script
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friendWebcomponents are your frameworks best friend
Webcomponents are your frameworks best friend
 
UML Intro
UML IntroUML Intro
UML Intro
 
Ballerina- A programming language for the networked world
Ballerina- A programming language for the networked worldBallerina- A programming language for the networked world
Ballerina- A programming language for the networked world
 
Ballerina- A programming language for the networked world
Ballerina- A programming language for the networked worldBallerina- A programming language for the networked world
Ballerina- A programming language for the networked world
 
Uml basics
Uml basicsUml basics
Uml basics
 
AlgorithmVisualiserProject_TanuJaiswal.pdf
AlgorithmVisualiserProject_TanuJaiswal.pdfAlgorithmVisualiserProject_TanuJaiswal.pdf
AlgorithmVisualiserProject_TanuJaiswal.pdf
 
AMIS OOW 2012 Review - Deel 4 ADF - Paco van der Linden
AMIS OOW 2012 Review - Deel 4 ADF - Paco van der LindenAMIS OOW 2012 Review - Deel 4 ADF - Paco van der Linden
AMIS OOW 2012 Review - Deel 4 ADF - Paco van der Linden
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and Play
 
Web programming and services
Web programming and servicesWeb programming and services
Web programming and services
 
Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1
 
Silver Light1.0
Silver Light1.0Silver Light1.0
Silver Light1.0
 
Why XAF and XPO?
Why XAF and XPO?Why XAF and XPO?
Why XAF and XPO?
 
Flex introduction
Flex introductionFlex introduction
Flex introduction
 

More from Sanat Maharjan

Automate+ Final Report
Automate+ Final ReportAutomate+ Final Report
Automate+ Final ReportSanat Maharjan
 
Automate+ Final Presentation
Automate+ Final PresentationAutomate+ Final Presentation
Automate+ Final PresentationSanat Maharjan
 
Network protocol structure scope
Network protocol structure scopeNetwork protocol structure scope
Network protocol structure scopeSanat Maharjan
 
Chap 6 IMplementation of Information System
Chap 6 IMplementation of Information SystemChap 6 IMplementation of Information System
Chap 6 IMplementation of Information SystemSanat Maharjan
 
Chapter 6 Information System-Critical Success Factor
Chapter 6 Information System-Critical Success FactorChapter 6 Information System-Critical Success Factor
Chapter 6 Information System-Critical Success FactorSanat Maharjan
 

More from Sanat Maharjan (7)

Automate+ Final Report
Automate+ Final ReportAutomate+ Final Report
Automate+ Final Report
 
Automate+ Final Presentation
Automate+ Final PresentationAutomate+ Final Presentation
Automate+ Final Presentation
 
Network protocol structure scope
Network protocol structure scopeNetwork protocol structure scope
Network protocol structure scope
 
Chap 6 IMplementation of Information System
Chap 6 IMplementation of Information SystemChap 6 IMplementation of Information System
Chap 6 IMplementation of Information System
 
Chapter 6 Information System-Critical Success Factor
Chapter 6 Information System-Critical Success FactorChapter 6 Information System-Critical Success Factor
Chapter 6 Information System-Critical Success Factor
 
AutoMate+
AutoMate+AutoMate+
AutoMate+
 
FarMate
FarMateFarMate
FarMate
 

Recently uploaded

ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 

Recently uploaded (20)

FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 

xaml overview

  • 1. XAML Overview Markup for WPF and Silverlight Gaurav Goyal Janardan Chaudhary Nimesh Mishra Sanat Maharjan IOE Pulchwok Engineering College
  • 3. WHAT IS XAML? • Stands for eXtensible Application Markup Language • Declarative markup language for building UI • Based on XML • Used to simplify creation of UI for a .NET apps • Separates presentation (UI) from business logic • XAML enables a workflow where different parties can work simultaneously • The UI and the logic of an application can be developed using different tools (VS and Blend)
  • 4. DECLARATIVE UI WITH XAML • XAML is a completely declarative language • A declarative language says "what" • An imperative language says "how" • XAML describes the behavior and integration of components (in most cases UI components) • Cannot describe business logic
  • 5. HISTORY OF XAML • Introduced in 2006 with .NET 3.0 • With Windows Presentation Foundation (WPF) • WPF is "the new way" to create desktop apps • Successor of Windows Forms • Silverlight is introduced in 2007 • Under the name WPF/E - WPF Everywhere • Used JavaScript for back-end • Windows Runtime (WinRT) introduced in 2011 • Used for Windows Store apps • Closer to Silverlight than WPF
  • 6. XAML-RELATED TECHNOLOGIES • Windows Presentation Foundation - WPF • The successor of Windows Forms • Uses XAML to describe the presentation (UI) • C# / VB.NET for the back-end logic • Silverlight • Develop RIA in collaboration with ASP.NET • Browsers need a Silverlight plugin • Windows Runtime - WinRT • Build Windows Store apps in Windows 8
  • 8. VECTOR GRAPHICS • All XAML graphics are Direct3D applications • Direct3D (part of DirectX) is used in graphical applications where performance is important • Uses the video card hardware for rendering • The result: high-quality rich-media UI • Vector-based graphics allow lossless scaling • XAML implements a floating-point logical pixel system and supports 32-bit ARGB color
  • 9. ANIMATION • XAML supports time-based animations • Presentation timers are initialized and managed by XAML • Scene changes are coordinated using a storyboard • Animations can be triggered by external events • Including user action or events • Animation can be defined on a per-object basis directly from the XAML markup
  • 10. AUDIO AND VIDEO SUPPORT • XAML can incorporate audio and video into a user interface • Audio support in XAML is a thin layer over the existing functionality in Win32 and WMP • XAML supports the videos formats that the OS supports • i.e. if WMP can play a file – XAML can too • Relationship between video and animation is also supported • They are both ways of showing moving images • Animation can be synchronized with media
  • 11. STYLES • In XAML a style is a set of properties applied to the content used for visual rendering • Similar to the concept of CSS • Use them to standardize non-formatting characteristics • XAML styles have specific features • Ability to apply different visual effects based on user events • Styles are created using MS Expression Blend 11
  • 12. TEMPLATES • Templates in XAML allow you to fully change the UI of anything in XAML • Different templates available within XAML • ControlTemplate • Manages the visualization of a control • ItemsPanelTemplate • Handles the visualization panel of list control • DataTemplate and HierarchicalDataTemplate • Responsible for the visualization of items in list controls 12
  • 13. COMMANDS • Commands are more abstract and loosely- coupled version of events • Examples: copy, cut, paste, save, etc. • XAML support for commands reduces the amount of code we need to write • It gives us more flexibility to change the UI without breaking the back-end logic • Commands have action, source, target and binding 13
  • 14. COMMANDS (2) • The power of commands: • XAML defines a number of built-in commands • Commands have automatic support for input actions • Some XAML controls have built-in behavior tied to various commands • Commands are intended to do two things: • Check whether an action is available • Execute an action 14
  • 15. OBJECT-BASED DRAWING • At the lower-level XAML works in terms of shapes, not in terms of painting pixels • Shapes are vector-based and are easily scaled • Developers create shape objects and let XAML maintain the view in the most optimized way • XAML provides a number of ready-to-use shape objects like line, rectangle, ellipse, path, etc. • Shape objects can be used inside panels and inside most XAML controls 15
  • 17. DECLARATIVE VS. PROGRAMMATICALLY • With XAML each element can be done either declaratively or programmatically • No difference in the execution or performance • Instantiating element from the code behind ruins the idea of XAML • The same as Windows Forms • The following two examples are identical <Button Content="Click me!"/> Button button=new Button(); button.Content="Click me!";  With XAML  With Code Behind
  • 18. DECLARATIVE UI • When not using XAML with WPF/Silverlight • Miss the idea of separation of concerns • Two parties cannot work simultaneously on the same file • What happens when making object declaratively? • It is the same as instantiating the element with parameterless constructor • All the magic happens in InitializeComponents()
  • 20. XAML SYNTAX • XAML stands for eXtensible Application Markup Language • i.e. uses syntax that is actually pure XML • Very similar to HTML • Meant to build applications' UI • Briefly XAML consists of • Elements • Properties • Elements may have properties
  • 21. ELEMENTS AND ATTRIBUTES • UI elements have a set of common properties and functions • Such as Width, Height, Cursor, and Tag properties • Declaring an XML element in XAML • Equivalent to instantiating the object via a parameterless constructor • Setting an attribute on the object element • Equivalent to setting a property with the same name • Elements and attributes are case sensitive • The attributes can be enclosed in single quotes (') or double quotes (")
  • 22. PROPERTY ELEMENTS • Not all properties have just a string value • Some must be set to an instance of an object • XAML provide syntax for setting complex property values, called property elements • Take the form TypeName.PropertyName contained inside an TypeName element 22 <Ellipse> <Ellipse.RenderTransform> <RotateTransform Angle="45" CenterY="60" /> </Ellipse.RenderTransform> </Ellipse> A property element
  • 23. CONTENT PROPERTIES • One of the element's properties is default • Known as content property • Typically contains the child elements • Content properties are used without prefix: 23 <Border> <TextBox Width="300"/> </Border> <!-- Explicit equivalent --> <Border> <Border.Child> <TextBox Width="300"/> </Border.Child> </Border> A content property A property element
  • 24. ATTACHED PROPERTIES • Attached properties are special kind of properties • Can be attached to any object • Not just the one defining the property • The syntax is the same as setting a normal property • The property must be prefixed with the name of the element defining the property and a dot 24
  • 25. ATTACHED PROPERTIES (2) • Attached properties allow common behavior to be applied to arbitrary elements • Allow a child item to access a property of its parent item • The base of Attached Behavior • Commonly used attached properties: • Canvas.Left and Canvas.Right • Grid.Row, Grid.Column and Grid.Rowspan 25
  • 26. ATTACHED PROPERTIES – EXAMPLE • Using the Canvas.Left and Canvas.Top attached properties to position Ellipses • The default value is 0 26 <Canvas> <Ellipse Fill="Green" Width="80" Height="80"/> <Ellipse Canvas.Left="25" Canvas.Top="25" Fill="Red" Width="80" Height="80"/> <Ellipse Canvas.Left="50" Canvas.Top="50" Fill="Purple" Width="80" Height="80"/> </Canvas> <!-- The result is : -->
  • 27. DEPENDENCY PROPERTIES • A Dependency Properties are properties that extend the functionality of a common language runtime (CLR) property • Interact with properties directly and never know that they are implemented as a dependency property • The purpose of dependency properties is to provide a way to compute the value of a property based on the value of other inputs
  • 28. DEPENDENCY PROPERTIES (2) • A Dependency Property can be implemented to provide • Self-contained validation • Default values • Callbacks that monitor changes to other properties • Example of Dependency Properties • Text property of TextBlock <TextBox Name="TextBoxFrom"/> <TextBlock Text="{ Binding ElementName=TextBoxFrom, Path=Text}"/> Gets the Text from the TextBox
  • 29. XAML CONTROLS • The controls are the smallest components of a XAML Application • Every control consists of • Appearance • Code-behind
  • 30. XAML CONTROL • XAML Controls are typically not directly responsible for their own appearance • XAML Controls are all about behavior • They defer to templates to provide their visuals
  • 31. XAML CONTROLS (2) • Controls may use commands to represent supported operations • Controls offer properties to provide a means of modifying either behavior • Controls raise events when something important happens • XAML provides a range of built-in controls • Most of these correspond to standard Windows control types
  • 32. ADVANTAGES OF XAML • XAML code is short and clear to read • Separation of designer code and logic • Graphical design tools like Expression Blend require XAML as source. • The separation of XAML and UI logic allows it to clearly separate the roles of designer and developer