SlideShare a Scribd company logo
WPF - Introduction
            By: Munish Arora
    munish.arora@gmail.com
What is WPF?
  It is a new foundation for building Windows-based applications by
  using:
   • Media

   • Documents

   • Application UI


   Windows                            Windows
   Presentation                       Workflow
   Foundation                         Foundation
   (WPF)                              (WF)
                      Windows
                      Communication                Windows
                      Foundation                   CardSpace
                      (WCF)                        (WCS)


  .NET Framework 4.0
WPF Architecture
  WPF Core Components                                         Provides the
                                                          presentation classes
                                                           that you use as a
                                                               developer
                PresentationFramework
 Managed Code                                             Provides a managed
                 PresentationCore                       wrapper for milcore and
                                                        implements much of the
                                                         underlying functionality
                 Common Language Runtime                         of WPF

                                         milcore       Unmanaged Code

                 User32                 DirectX
                                                        Written in UnManaged
Low level API                                           code in order to enable
 for handling            DirectX enables all display     tight integration with
 user actions               handling in WPF, and        DirectX. It renders each
                        provides efficient hardware        WPF element on a
                          and software rendering            DirectX surface
WPF
• WPF allows using both uses declarative language such as XAML and
  programming language (such has C#) to provide behavior




• When you add an element in XAML, the WPF runtime instantiates
  the object in the same way that you would programmatically
  instantiate an object in the code-behind file.
WPF Application Types




  Stand-Alone Applications   XAML Browser Applications (XBAPs)

  You use this type of              You use this type of
    application when               application when your
   you require access             application can run with
  to system resources                limited permission
Creating a Simple WPF Application
In this demonstration, you will see how to
• Create a stand-alone WPF application
• Create a browser application
• Add controls to your application
Routed Events
•   Routed events are a new concept to most developers. In good old fashioned
    .NET 1.x/2.0, we all probably used some custom events or hooked some
    delegates onto some existing event, such as:

private System.Web.Forms.Button button1;
button1.click+=new EventHandler(button1_Click);
...
private void button1_Click(object sender, EventArge e)
{
    //Click Event seen, so something about it
}
Routed Events
•   When you create an application that has user interface, your application uses
    events to respond to user actions. E.g. when user clicks button, then it fires
    and event. So, corresponding code can be written to handle the events.
    These events thus define the behavior of application.

•   In WPF the elements are arranged in hierarchical order known as element
    tree. e.g.




•   Here StackPanel container control is inside the Windows element and Button
    controls are inside the StackPanel. Routed events are similar to events but
    their notification can move up or down the hierarchy tree.
Routed Events
•   There are three types of event notification methods, namely:

     – Bubbling: Allows events to bubble up the VisualTree (the tree of Visual
       UI Elements), to the root element.

     – Tunneling: Allows events to tunnel down the VisualTree.

     – Direct: Works just like the old .NET 1.x/2.0 CLR events. Only the
       subscriber gets to see the event. The one we see above is Direct event
       notification
Routed Events - Example
•   In this example, we will see how Routing works. Such that when button is
    clicked, the event goes to the container which may handle this.
     – Steps:
         • Add a StackPanel in the Grid
         • Add buttons to stack panel
         • Add a label in Grid
         • Now add an EventHandler for click in StackPanel, such that when
           button is clicked, label should display that this button has been
           clicked
         • Then we will add another button via code and check that if this newly
           added button is clicked, does it work in a similar way?
Navigation Capabilities
• Let us create a XABP (XAML Browser Application)
   – Where-in you can browse from one page to other page and vice-versa
THANK YOU!

More Related Content

What's hot

What Is Silverlight
What Is SilverlightWhat Is Silverlight
What Is Silverlight
guest50274e
 
Silverlight - What Is It And How Can We Use It
Silverlight - What Is It And How Can We Use ItSilverlight - What Is It And How Can We Use It
Silverlight - What Is It And How Can We Use It
Venketash (Pat) Ramadass
 
Flex_Basic_Training
Flex_Basic_TrainingFlex_Basic_Training
Flex_Basic_Training
guest25cec3
 

What's hot (19)

WPF & Silverlight Intro
WPF & Silverlight IntroWPF & Silverlight Intro
WPF & Silverlight Intro
 
What Is Silverlight
What Is SilverlightWhat Is Silverlight
What Is Silverlight
 
What Is Silverlight
What Is SilverlightWhat Is Silverlight
What Is Silverlight
 
Visual Basic User Interface-III
Visual Basic User Interface-IIIVisual Basic User Interface-III
Visual Basic User Interface-III
 
Silverlight - What Is It And How Can We Use It
Silverlight - What Is It And How Can We Use ItSilverlight - What Is It And How Can We Use It
Silverlight - What Is It And How Can We Use It
 
Silverlight
SilverlightSilverlight
Silverlight
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
 
Silver Light
Silver LightSilver Light
Silver Light
 
Building a mobile application for dot netnuke
Building a mobile application for dot netnukeBuilding a mobile application for dot netnuke
Building a mobile application for dot netnuke
 
Introduction to DL-BUILDER
Introduction to DL-BUILDERIntroduction to DL-BUILDER
Introduction to DL-BUILDER
 
Introduction to silver light
Introduction to silver lightIntroduction to silver light
Introduction to silver light
 
An Introduction to the Model-View-Controller Pattern
An Introduction to the Model-View-Controller PatternAn Introduction to the Model-View-Controller Pattern
An Introduction to the Model-View-Controller Pattern
 
Chpater1
Chpater1Chpater1
Chpater1
 
Ria Development With Flex And PHP
Ria Development With Flex And PHPRia Development With Flex And PHP
Ria Development With Flex And PHP
 
Silverlight
SilverlightSilverlight
Silverlight
 
Flex_Basic_Training
Flex_Basic_TrainingFlex_Basic_Training
Flex_Basic_Training
 
Building Modern Web Apps Using ASP.NET 5
Building Modern Web Apps Using ASP.NET 5Building Modern Web Apps Using ASP.NET 5
Building Modern Web Apps Using ASP.NET 5
 
Silverlight Framework Architecture By Satyen
Silverlight Framework Architecture By SatyenSilverlight Framework Architecture By Satyen
Silverlight Framework Architecture By Satyen
 
The Business of Microsoft Silverlight
The Business of Microsoft SilverlightThe Business of Microsoft Silverlight
The Business of Microsoft Silverlight
 

Viewers also liked

Viewers also liked (9)

Analyse et optimisation des performances des applications Windows Phone 7.5
Analyse et optimisation des performances des applications Windows Phone 7.5Analyse et optimisation des performances des applications Windows Phone 7.5
Analyse et optimisation des performances des applications Windows Phone 7.5
 
Bornes, écrans, automates: ce qui se cache derrière les systèmes embarqués qu...
Bornes, écrans, automates: ce qui se cache derrière les systèmes embarqués qu...Bornes, écrans, automates: ce qui se cache derrière les systèmes embarqués qu...
Bornes, écrans, automates: ce qui se cache derrière les systèmes embarqués qu...
 
Le déclin-de-lempire-masculin
Le déclin-de-lempire-masculinLe déclin-de-lempire-masculin
Le déclin-de-lempire-masculin
 
La plateforme de développement Microsoft pour les nuls
La plateforme de développement Microsoft pour les nulsLa plateforme de développement Microsoft pour les nuls
La plateforme de développement Microsoft pour les nuls
 
Le binding en wpf
Le binding en wpfLe binding en wpf
Le binding en wpf
 
Introducthion mvvm avec wpf
Introducthion mvvm avec wpfIntroducthion mvvm avec wpf
Introducthion mvvm avec wpf
 
WPF 4.5 : Quoi de neuf pour les développeurs ?
WPF 4.5 : Quoi de neuf pour les développeurs ?WPF 4.5 : Quoi de neuf pour les développeurs ?
WPF 4.5 : Quoi de neuf pour les développeurs ?
 
Wygday2010 - silverlight 4 & wpf 4
Wygday2010 -  silverlight 4 & wpf 4Wygday2010 -  silverlight 4 & wpf 4
Wygday2010 - silverlight 4 & wpf 4
 
Blend 2015, un nouveau look et de nouvelles fonctionnalités pour les développ...
Blend 2015, un nouveau look et de nouvelles fonctionnalités pour les développ...Blend 2015, un nouveau look et de nouvelles fonctionnalités pour les développ...
Blend 2015, un nouveau look et de nouvelles fonctionnalités pour les développ...
 

Similar to Introduction to WPF

Building Windows Presentation Foundation (WPF) Application
Building Windows Presentation Foundation (WPF) ApplicationBuilding Windows Presentation Foundation (WPF) Application
Building Windows Presentation Foundation (WPF) Application
ssusere19c741
 
Building Windows Presentation Foundation (WPF) Application
Building Windows Presentation Foundation (WPF) ApplicationBuilding Windows Presentation Foundation (WPF) Application
Building Windows Presentation Foundation (WPF) Application
ssusere19c741
 
Introduction to XAML and WPF
Introduction to XAML and WPFIntroduction to XAML and WPF
Introduction to XAML and WPF
Doncho Minkov
 

Similar to Introduction to WPF (20)

Building Windows Presentation Foundation (WPF) Application
Building Windows Presentation Foundation (WPF) ApplicationBuilding Windows Presentation Foundation (WPF) Application
Building Windows Presentation Foundation (WPF) Application
 
Building Windows Presentation Foundation (WPF) Application
Building Windows Presentation Foundation (WPF) ApplicationBuilding Windows Presentation Foundation (WPF) Application
Building Windows Presentation Foundation (WPF) Application
 
WPF - the future of GUI is near
WPF - the future of GUI is nearWPF - the future of GUI is near
WPF - the future of GUI is near
 
WPF
WPFWPF
WPF
 
introduction to_mfc
 introduction to_mfc introduction to_mfc
introduction to_mfc
 
WPF
WPFWPF
WPF
 
480 483
480 483480 483
480 483
 
Introduction to XAML and WPF
Introduction to XAML and WPFIntroduction to XAML and WPF
Introduction to XAML and WPF
 
Building Universal Windows Apps for Smartphones and Tablets with XAML & C#
Building Universal Windows Apps for Smartphones and Tablets with XAML & C#Building Universal Windows Apps for Smartphones and Tablets with XAML & C#
Building Universal Windows Apps for Smartphones and Tablets with XAML & C#
 
How to modernise WPF and Windows Forms applications with Windows Apps SDK
How to modernise WPF and Windows Forms applications with Windows Apps SDKHow to modernise WPF and Windows Forms applications with Windows Apps SDK
How to modernise WPF and Windows Forms applications with Windows Apps SDK
 
Selje_Amazing VFP2C32 Library.pdf
Selje_Amazing VFP2C32 Library.pdfSelje_Amazing VFP2C32 Library.pdf
Selje_Amazing VFP2C32 Library.pdf
 
Building RIA Apps with Silverlight
Building RIA Apps with SilverlightBuilding RIA Apps with Silverlight
Building RIA Apps with Silverlight
 
Introduction to wpf
Introduction to wpfIntroduction to wpf
Introduction to wpf
 
Event Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdfEvent Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdf
 
Web services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows FormsWeb services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows Forms
 
Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)
 
Plug yourself in and your app will never be the same (2 hour edition)
Plug yourself in and your app will never be the same (2 hour edition)Plug yourself in and your app will never be the same (2 hour edition)
Plug yourself in and your app will never be the same (2 hour edition)
 
Complete WPF Overview Tutorial with Example - iFour Technolab
Complete WPF Overview Tutorial with Example - iFour TechnolabComplete WPF Overview Tutorial with Example - iFour Technolab
Complete WPF Overview Tutorial with Example - iFour Technolab
 
10 gui 14
10 gui 1410 gui 14
10 gui 14
 
Mca 504 dotnet_unit1
Mca 504 dotnet_unit1Mca 504 dotnet_unit1
Mca 504 dotnet_unit1
 

Recently uploaded

Recently uploaded (20)

Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdf
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Transforming The New York Times: Empowering Evolution through UX
Transforming The New York Times: Empowering Evolution through UXTransforming The New York Times: Empowering Evolution through UX
Transforming The New York Times: Empowering Evolution through UX
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Motion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in TechnologyMotion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in Technology
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 

Introduction to WPF

  • 1. WPF - Introduction By: Munish Arora munish.arora@gmail.com
  • 2. What is WPF? It is a new foundation for building Windows-based applications by using: • Media • Documents • Application UI Windows Windows Presentation Workflow Foundation Foundation (WPF) (WF) Windows Communication Windows Foundation CardSpace (WCF) (WCS) .NET Framework 4.0
  • 3. WPF Architecture WPF Core Components Provides the presentation classes that you use as a developer PresentationFramework Managed Code Provides a managed PresentationCore wrapper for milcore and implements much of the underlying functionality Common Language Runtime of WPF milcore Unmanaged Code User32 DirectX Written in UnManaged Low level API code in order to enable for handling DirectX enables all display tight integration with user actions handling in WPF, and DirectX. It renders each provides efficient hardware WPF element on a and software rendering DirectX surface
  • 4. WPF • WPF allows using both uses declarative language such as XAML and programming language (such has C#) to provide behavior • When you add an element in XAML, the WPF runtime instantiates the object in the same way that you would programmatically instantiate an object in the code-behind file.
  • 5. WPF Application Types Stand-Alone Applications XAML Browser Applications (XBAPs) You use this type of You use this type of application when application when your you require access application can run with to system resources limited permission
  • 6. Creating a Simple WPF Application In this demonstration, you will see how to • Create a stand-alone WPF application • Create a browser application • Add controls to your application
  • 7. Routed Events • Routed events are a new concept to most developers. In good old fashioned .NET 1.x/2.0, we all probably used some custom events or hooked some delegates onto some existing event, such as: private System.Web.Forms.Button button1; button1.click+=new EventHandler(button1_Click); ... private void button1_Click(object sender, EventArge e) { //Click Event seen, so something about it }
  • 8. Routed Events • When you create an application that has user interface, your application uses events to respond to user actions. E.g. when user clicks button, then it fires and event. So, corresponding code can be written to handle the events. These events thus define the behavior of application. • In WPF the elements are arranged in hierarchical order known as element tree. e.g. • Here StackPanel container control is inside the Windows element and Button controls are inside the StackPanel. Routed events are similar to events but their notification can move up or down the hierarchy tree.
  • 9. Routed Events • There are three types of event notification methods, namely: – Bubbling: Allows events to bubble up the VisualTree (the tree of Visual UI Elements), to the root element. – Tunneling: Allows events to tunnel down the VisualTree. – Direct: Works just like the old .NET 1.x/2.0 CLR events. Only the subscriber gets to see the event. The one we see above is Direct event notification
  • 10. Routed Events - Example • In this example, we will see how Routing works. Such that when button is clicked, the event goes to the container which may handle this. – Steps: • Add a StackPanel in the Grid • Add buttons to stack panel • Add a label in Grid • Now add an EventHandler for click in StackPanel, such that when button is clicked, label should display that this button has been clicked • Then we will add another button via code and check that if this newly added button is clicked, does it work in a similar way?
  • 11. Navigation Capabilities • Let us create a XABP (XAML Browser Application) – Where-in you can browse from one page to other page and vice-versa