SlideShare a Scribd company logo
1 of 35
Working with XAML and
C# (Cont.)
Prepared by Mohamed Samir & Khaled Taher
1
2
3
4
5
6
7
8
Visual Assets
Command Bars
Event Handler
Data Binding
Navigation
Layouts
Agenda
Message Dialog
Exercise
Visual Assets
Splash Screen :
• The first image to show before your
application starts.
Visual Assets
App Logo:
•The symbolic picture of your app.
Store Logo:
• The logo that appears in windows store
discription
Visual Assets
Step 1:
Add the photos
you want to
apply in the app
to the Assets.
Visual Assets
Step 2:
Open
“Package.appxmanifest”
Visual Assets
Step 3:
Scroll down to:
• Splash Screen
• Square 150×150 logo
• Square 30×30 logo
• Store Logo
And change their locations
with “Assets/filename.png”
Command Bars
Provide user with easy access to your app's
most common tasks.
• See More
• Content
• Primary Commands
• Secondary Commands
[…]
Command Bars
Command Bars
Primary commands and secondary
command can only be populated by
app bar controls :
• AppBarButton
• AppBarToggleButton
• AppBarSeparator
Command Bars
AppBarToggleButton
Allows you to have 2 states for a given button
through its 2 properties (Checked, Unchecked)
Command Bars
The labels of the buttons can be controlled
via the command bar properties itself, not
the buttons.
DefaultLabelPosition = “Right”
LabelPosition = “Collapsed”
Command Bars
You can control how the command bar is shown in its closed
state via ClosedDisplayMode property.
• ClosedDisplayMode = “Compact”
(Shows content, primary command icons without labels, and the
"see more" [•••] button.)
• ClosedDisplayMode = “Minimal”
(Shows only a thin bar that acts as the "see more" [•••] button)
Event Handler
A method/function in behind-code does a task
corresponding to the event invoked it.
• Click
• DoubleTapped
• GotFocus
• LostFocus
Event Handler
The event property “Click” value is the function
name in code-behind.
<Button Content = “Button1” Background
= “Green” Click = “MyClick” >
</Button>
private void MyClick (object sender,
RoutedEventArgs e )
{
// What to do on the click
}
XAML C#
Data Binding
• Data binding allows the flow of data between UI elements
and data object on user code
•Types of binding
– One way
– Two way (later sessions)
– Element binding
– In one-way binding, the data is
bound from its source, (the
object that holds the data) to its
target (the object that displays
the data)
One way
Data Binding
•It is also possible to bind, not to a standard
data source, but rather to another element on
the page
Element Binding
<StackPanel VerticalAlignment = "Center" HorizontalAlignment = "Center">
<Rectangle Height = "100" Width = "100" Fill = "SteelBlue" RenderTransformOrigin = "0.5,0.5" Margin = "50">
<Rectangle.RenderTransform> <CompositeTransform ScaleX = "{Binding Value, ElementName = MySlider}"
ScaleY = "{Binding Value, ElementName = MySlider}"/>
</Rectangle.RenderTransform>
</Rectangle>
<Slider Minimum = ".5" Maximum = "2.0" StepFrequency = ".1" x:Name = "MySlider" />
</StackPanel>
Data Binding
Data Binding
Element Binding
Navigation
The process of moving from
a page to another.
You need to:
1) Determine the event that decides the
navigation (clicking a button/photo/ etc..)
2) Write navigation code in the event code-
behind. (handler method)
Navigation
For an image with DoubleTapped property “Nave”:
private void Nave (object sender, RoutedEventArgs e )
{
// Navigation Code
this.Frame.Navigate(typeof(PageName), PassedValue) ;
}
Navigation
Navigation could be done to a web page too, not
only local pages in the app.
In that case no back-end c# code is required, but
the XAML control must be within a hyperlink
button.
Navigation
• Navigation through normal text (hyperlink)
• Navigation through an image (hyperlink)
Message Dialog
A pop-up window used to tell the user a
message (with the ability to add actions
based on his click)
Message Dialog
Message Dialog
Layouts
TailoredAdaptiveResponsive
Responsive
• Also called fluid layout
• Use layout properties and panels to
make your default UI fluid.
Layouts
• The various Panel classes provide
different ways to size and position
their children such as:
– Canvas
– Grid
– Stack Panel
– Relative Panel
Layouts
Relative Panel
• Defines an area within which you can
position and align child objects in relation
to each other or the parent panel.
<RelativePanel BorderBrush="Gray" BorderThickness="10">
<Rectangle x:Name="RedRect" Fill="Red" MinHeight="100" MinWidth="100"/> <Rectangle
x:Name="BlueRect" Fill="Blue" MinHeight="100" MinWidth="100"
RelativePanel.RightOf="RedRect"/>
<!-- Width is not set on the green and yellow rectangles. It's determined by the RelativePanel
properties. -->
<Rectangle x:Name="GreenRect" Fill="Green" MinHeight="100" Margin="0,5,0,0"
RelativePanel.Below="RedRect" RelativePanel.AlignLeftWith="RedRect"
RelativePanel.AlignRightWith="BlueRect"/>
<Rectangle Fill="Yellow" MinHeight="100" RelativePanel.Below="GreenRect"
RelativePanel.AlignLeftWith="BlueRect" RelativePanel.AlignRightWithPanel="True"/>
</RelativePanel>
Layouts
Adaptive
Layouts
Tailored
Layouts
Exercise
Session 5#
Session 5#

More Related Content

Similar to Session 5#

DotNetNuke Client API -DragDropAdminModules.pdf
DotNetNuke Client API -DragDropAdminModules.pdfDotNetNuke Client API -DragDropAdminModules.pdf
DotNetNuke Client API -DragDropAdminModules.pdfarunagulla
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgetsSiva Kumar reddy Vasipally
 
Silverlight week2
Silverlight week2Silverlight week2
Silverlight week2iedotnetug
 
ADF Mobile - an intro for Developers
ADF Mobile - an intro for DevelopersADF Mobile - an intro for Developers
ADF Mobile - an intro for DevelopersLuc Bors
 
ADF Mobile: 10 Things you don't get from the developers guide
ADF Mobile: 10 Things you don't get from the developers guideADF Mobile: 10 Things you don't get from the developers guide
ADF Mobile: 10 Things you don't get from the developers guideLuc Bors
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOSfpatton
 
WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2Shahzad
 
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 nearBartlomiej Filipek
 
Oracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptxOracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptxLuc Bors
 
Optimizing Flex Applications
Optimizing Flex ApplicationsOptimizing Flex Applications
Optimizing Flex Applicationsdcoletta
 
Busy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript AppsBusy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript AppsJAX London
 
Overview of WPF in light of Ribbon UI Control
Overview of WPF in light of Ribbon UI ControlOverview of WPF in light of Ribbon UI Control
Overview of WPF in light of Ribbon UI ControlAbhishek Sur
 
ADF and JavaScript - AMIS SIG, July 2017
ADF and JavaScript - AMIS SIG, July 2017ADF and JavaScript - AMIS SIG, July 2017
ADF and JavaScript - AMIS SIG, July 2017Lucas Jellema
 
Practical tipsmakemobilefaster oscon2016
Practical tipsmakemobilefaster oscon2016Practical tipsmakemobilefaster oscon2016
Practical tipsmakemobilefaster oscon2016Doris Chen
 

Similar to Session 5# (20)

DotNetNuke Client API -DragDropAdminModules.pdf
DotNetNuke Client API -DragDropAdminModules.pdfDotNetNuke Client API -DragDropAdminModules.pdf
DotNetNuke Client API -DragDropAdminModules.pdf
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgets
 
Silverlight week2
Silverlight week2Silverlight week2
Silverlight week2
 
ADF Mobile - an intro for Developers
ADF Mobile - an intro for DevelopersADF Mobile - an intro for Developers
ADF Mobile - an intro for Developers
 
ADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
ADF Mobile: 10 Things you don't get from the developers guide - Luc BorsADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
ADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
 
ADF Mobile: 10 Things you don't get from the developers guide
ADF Mobile: 10 Things you don't get from the developers guideADF Mobile: 10 Things you don't get from the developers guide
ADF Mobile: 10 Things you don't get from the developers guide
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOS
 
WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2
 
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
 
Introduction to flutter
Introduction to flutter Introduction to flutter
Introduction to flutter
 
Oracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptxOracle MAF real life OOW.pptx
Oracle MAF real life OOW.pptx
 
Optimizing Flex Applications
Optimizing Flex ApplicationsOptimizing Flex Applications
Optimizing Flex Applications
 
Busy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript AppsBusy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript Apps
 
Overview of WPF in light of Ribbon UI Control
Overview of WPF in light of Ribbon UI ControlOverview of WPF in light of Ribbon UI Control
Overview of WPF in light of Ribbon UI Control
 
ADF and JavaScript - AMIS SIG, July 2017
ADF and JavaScript - AMIS SIG, July 2017ADF and JavaScript - AMIS SIG, July 2017
ADF and JavaScript - AMIS SIG, July 2017
 
Visual basic
Visual basic Visual basic
Visual basic
 
Client Web
Client WebClient Web
Client Web
 
WPF Fundamentals
WPF FundamentalsWPF Fundamentals
WPF Fundamentals
 
Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
 
Practical tipsmakemobilefaster oscon2016
Practical tipsmakemobilefaster oscon2016Practical tipsmakemobilefaster oscon2016
Practical tipsmakemobilefaster oscon2016
 

More from Mohamed Samir

Fight for the quality of architecture against delivery - JobStack Cegedim
Fight for the quality of architecture against delivery - JobStack Cegedim Fight for the quality of architecture against delivery - JobStack Cegedim
Fight for the quality of architecture against delivery - JobStack Cegedim Mohamed Samir
 
An evaluation of FaaS platforms as a foundation for serverless big data proce...
An evaluation of FaaS platforms as a foundation for serverless big data proce...An evaluation of FaaS platforms as a foundation for serverless big data proce...
An evaluation of FaaS platforms as a foundation for serverless big data proce...Mohamed Samir
 
Serverless Computing Model
Serverless Computing ModelServerless Computing Model
Serverless Computing ModelMohamed Samir
 

More from Mohamed Samir (8)

Fight for the quality of architecture against delivery - JobStack Cegedim
Fight for the quality of architecture against delivery - JobStack Cegedim Fight for the quality of architecture against delivery - JobStack Cegedim
Fight for the quality of architecture against delivery - JobStack Cegedim
 
An evaluation of FaaS platforms as a foundation for serverless big data proce...
An evaluation of FaaS platforms as a foundation for serverless big data proce...An evaluation of FaaS platforms as a foundation for serverless big data proce...
An evaluation of FaaS platforms as a foundation for serverless big data proce...
 
Serverless Computing Model
Serverless Computing ModelServerless Computing Model
Serverless Computing Model
 
Session 6#
Session 6#Session 6#
Session 6#
 
Session 4#
Session 4#Session 4#
Session 4#
 
Session 3#
Session 3#Session 3#
Session 3#
 
Session#2
Session#2Session#2
Session#2
 
Session#1
Session#1Session#1
Session#1
 

Recently uploaded

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
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
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 

Recently uploaded (20)

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
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 🔝✔️✔️
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 

Session 5#

  • 1. Working with XAML and C# (Cont.) Prepared by Mohamed Samir & Khaled Taher
  • 2. 1 2 3 4 5 6 7 8 Visual Assets Command Bars Event Handler Data Binding Navigation Layouts Agenda Message Dialog Exercise
  • 3. Visual Assets Splash Screen : • The first image to show before your application starts.
  • 4. Visual Assets App Logo: •The symbolic picture of your app. Store Logo: • The logo that appears in windows store discription
  • 5. Visual Assets Step 1: Add the photos you want to apply in the app to the Assets.
  • 7. Visual Assets Step 3: Scroll down to: • Splash Screen • Square 150×150 logo • Square 30×30 logo • Store Logo And change their locations with “Assets/filename.png”
  • 8. Command Bars Provide user with easy access to your app's most common tasks. • See More • Content • Primary Commands • Secondary Commands […]
  • 10. Command Bars Primary commands and secondary command can only be populated by app bar controls : • AppBarButton • AppBarToggleButton • AppBarSeparator
  • 11. Command Bars AppBarToggleButton Allows you to have 2 states for a given button through its 2 properties (Checked, Unchecked)
  • 12. Command Bars The labels of the buttons can be controlled via the command bar properties itself, not the buttons. DefaultLabelPosition = “Right” LabelPosition = “Collapsed”
  • 13. Command Bars You can control how the command bar is shown in its closed state via ClosedDisplayMode property. • ClosedDisplayMode = “Compact” (Shows content, primary command icons without labels, and the "see more" [•••] button.) • ClosedDisplayMode = “Minimal” (Shows only a thin bar that acts as the "see more" [•••] button)
  • 14. Event Handler A method/function in behind-code does a task corresponding to the event invoked it. • Click • DoubleTapped • GotFocus • LostFocus
  • 15. Event Handler The event property “Click” value is the function name in code-behind. <Button Content = “Button1” Background = “Green” Click = “MyClick” > </Button> private void MyClick (object sender, RoutedEventArgs e ) { // What to do on the click } XAML C#
  • 16. Data Binding • Data binding allows the flow of data between UI elements and data object on user code •Types of binding – One way – Two way (later sessions) – Element binding
  • 17. – In one-way binding, the data is bound from its source, (the object that holds the data) to its target (the object that displays the data) One way Data Binding
  • 18. •It is also possible to bind, not to a standard data source, but rather to another element on the page Element Binding <StackPanel VerticalAlignment = "Center" HorizontalAlignment = "Center"> <Rectangle Height = "100" Width = "100" Fill = "SteelBlue" RenderTransformOrigin = "0.5,0.5" Margin = "50"> <Rectangle.RenderTransform> <CompositeTransform ScaleX = "{Binding Value, ElementName = MySlider}" ScaleY = "{Binding Value, ElementName = MySlider}"/> </Rectangle.RenderTransform> </Rectangle> <Slider Minimum = ".5" Maximum = "2.0" StepFrequency = ".1" x:Name = "MySlider" /> </StackPanel> Data Binding
  • 20. Navigation The process of moving from a page to another. You need to: 1) Determine the event that decides the navigation (clicking a button/photo/ etc..) 2) Write navigation code in the event code- behind. (handler method)
  • 21. Navigation For an image with DoubleTapped property “Nave”: private void Nave (object sender, RoutedEventArgs e ) { // Navigation Code this.Frame.Navigate(typeof(PageName), PassedValue) ; }
  • 22. Navigation Navigation could be done to a web page too, not only local pages in the app. In that case no back-end c# code is required, but the XAML control must be within a hyperlink button.
  • 23. Navigation • Navigation through normal text (hyperlink) • Navigation through an image (hyperlink)
  • 24. Message Dialog A pop-up window used to tell the user a message (with the ability to add actions based on his click)
  • 28. Responsive • Also called fluid layout • Use layout properties and panels to make your default UI fluid. Layouts
  • 29. • The various Panel classes provide different ways to size and position their children such as: – Canvas – Grid – Stack Panel – Relative Panel Layouts
  • 30. Relative Panel • Defines an area within which you can position and align child objects in relation to each other or the parent panel. <RelativePanel BorderBrush="Gray" BorderThickness="10"> <Rectangle x:Name="RedRect" Fill="Red" MinHeight="100" MinWidth="100"/> <Rectangle x:Name="BlueRect" Fill="Blue" MinHeight="100" MinWidth="100" RelativePanel.RightOf="RedRect"/> <!-- Width is not set on the green and yellow rectangles. It's determined by the RelativePanel properties. --> <Rectangle x:Name="GreenRect" Fill="Green" MinHeight="100" Margin="0,5,0,0" RelativePanel.Below="RedRect" RelativePanel.AlignLeftWith="RedRect" RelativePanel.AlignRightWith="BlueRect"/> <Rectangle Fill="Yellow" MinHeight="100" RelativePanel.Below="GreenRect" RelativePanel.AlignLeftWith="BlueRect" RelativePanel.AlignRightWithPanel="True"/> </RelativePanel> Layouts