SlideShare a Scribd company logo
Data Binding
Data Binding
Data binding is the technique of linking properties of
two objects so that changes in one property are
automatically reflected in the other property. Data
binding is an integral part of the Model-View-
ViewModel (MVVM) application architecture.
Basic Bindings
Basic Bindings
A Xamarin.Forms data binding links a pair of
properties between two objects, at least one of which
is usually a user-interface object. These two objects
are called the target and the source:
• The target is the object (and property) on which the data binding is set.
• The source is the object (and property) referenced by the data binding.
Binding Mode
Binding Mode
Allow to set the behavior of each data binding, the
available options in Xamarin.Forms are:
• Default
• TwoWay – data goes both ways between source and target
• OneWay – data goes from source to target
• OneWayToSource – data goes from target to source
• OneTime – data goes from source to target, but only when
the BindingContext changes (>=Xamarin.Forms 3.0)
**Each property has his own default binding mode**
String Formatting
String Formatting
Sometimes it's convenient to use data bindings to
display the string representation of an object or value.
For example, you might want to use a Label to display
the current value of a Slider. In this data binding,
the Slider is the source, and the target is
the Text property of the Label.
Binding Path
Binding Path
The Path property of the Binding class (or
the Path property of the Binding markup extension)
has been set to a single property. It's actually possible
to set Path to a sub-property (a property of a
property), or to a member of a collection.
Binding Value Converters
Binding Value Converters
Data bindings usually transfer data from a source
property to a target property, and in some cases from
the target property to the source property. This
transfer is straightforward when the source and target
properties are of the same type, or when one type can
be converted to the other type through an implicit
conversion. When that is not the case, a type
conversion must take place.
Relative Bindings
Relative Bindings
Relative bindings provide the ability to set the binding source
relative to the position of the binding target. They are created with
the RelativeSource markup extension, and set as
the Source property of a binding expression.
The RelativeSource markup extension is supported by
the RelativeSourceExtension class, which defines the following
properties:
• Mode
• AncestorLevel
• AncestorType
Relative Bindings
Modes:
• TemplatedParent indicates the element to which the template, in
which the bound element exists, is applied.
• Self indicates the element on which the binding is being set,
allowing you to bind one property of that element to another
property on the same element.
• FindAncestor indicates the ancestor in the visual tree of the
bound element.
• FindAncestorBindingContext indicates the BindingContext of the
ancestor in the visual tree of the bound element.
Binding Fallbacks
Binding Fallbacks
Sometimes data bindings fail, because the binding
source can't be resolved, or because the binding
succeeds but returns a nullvalue.
Two options are available:
• FallbackValue: allows a fallback value to be defined that will be
used when the binding source can't be resolved.
• TargetNullValue: allows a replacement value to be defined that
will be used when the binding source is resolved, but the value
is null.
Compiled Bindings
Compiled Bindings
Compiled bindings improve data binding performance in
Xamarin.Forms applications by resolving binding expressions at
compile-time rather than runtime. In addition, this compile-time
validation of binding expressions enables a better developer
troubleshooting experience because invalid bindings are reported
as build errors.
The process for using compiled bindings is to:
• Enable XAML compilation. For more information about XAML
compilation, see XAML Compilation.
• Set an x:DataType attribute on a VisualElement to the type of the object
that the VisualElement and its children will bind to.
https://github.com/AlejandroRuiz/NetConfFocusXamarin

More Related Content

What's hot

Front end development best practices
Front end development best practicesFront end development best practices
Front end development best practicesKarolina Coates
 
My Sql Data Migration
My Sql Data MigrationMy Sql Data Migration
My Sql Data MigrationAnil Yadav
 
Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code firstConfiz
 
Protecting your data at rest with Apache Kafka by Confluent and Vormetric
Protecting your data at rest with Apache Kafka by Confluent and VormetricProtecting your data at rest with Apache Kafka by Confluent and Vormetric
Protecting your data at rest with Apache Kafka by Confluent and Vormetricconfluent
 
Spring Mvc,Java, Spring
Spring Mvc,Java, SpringSpring Mvc,Java, Spring
Spring Mvc,Java, Springifnu bima
 
Sql server 2019 new features
Sql server 2019 new featuresSql server 2019 new features
Sql server 2019 new featuresGeorge Walters
 
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsAngular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsDigamber Singh
 
Using WebServices with Vertex
Using WebServices with Vertex Using WebServices with Vertex
Using WebServices with Vertex Donald Fernandes
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overviewAlex Bachuk
 
MVVM with WPF
MVVM with WPFMVVM with WPF
MVVM with WPFS V
 
Angular 10 course_content
Angular 10 course_contentAngular 10 course_content
Angular 10 course_contentNAVEENSAGGAM1
 
Microsoft Data Integration Pipelines: Azure Data Factory and SSIS
Microsoft Data Integration Pipelines: Azure Data Factory and SSISMicrosoft Data Integration Pipelines: Azure Data Factory and SSIS
Microsoft Data Integration Pipelines: Azure Data Factory and SSISMark Kromer
 

What's hot (20)

Front end development best practices
Front end development best practicesFront end development best practices
Front end development best practices
 
My Sql Data Migration
My Sql Data MigrationMy Sql Data Migration
My Sql Data Migration
 
Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code first
 
Protecting your data at rest with Apache Kafka by Confluent and Vormetric
Protecting your data at rest with Apache Kafka by Confluent and VormetricProtecting your data at rest with Apache Kafka by Confluent and Vormetric
Protecting your data at rest with Apache Kafka by Confluent and Vormetric
 
Creating Apps with .NET MAUI
Creating Apps with .NET MAUICreating Apps with .NET MAUI
Creating Apps with .NET MAUI
 
Firebase
FirebaseFirebase
Firebase
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Spring Mvc,Java, Spring
Spring Mvc,Java, SpringSpring Mvc,Java, Spring
Spring Mvc,Java, Spring
 
Sql server 2019 new features
Sql server 2019 new featuresSql server 2019 new features
Sql server 2019 new features
 
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsAngular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive Forms
 
Using WebServices with Vertex
Using WebServices with Vertex Using WebServices with Vertex
Using WebServices with Vertex
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overview
 
Getting started with entity framework
Getting started with entity framework Getting started with entity framework
Getting started with entity framework
 
Autonomous Data Warehouse
Autonomous Data WarehouseAutonomous Data Warehouse
Autonomous Data Warehouse
 
MVVM with WPF
MVVM with WPFMVVM with WPF
MVVM with WPF
 
Firebase
FirebaseFirebase
Firebase
 
Angular 10 course_content
Angular 10 course_contentAngular 10 course_content
Angular 10 course_content
 
Microsoft Data Integration Pipelines: Azure Data Factory and SSIS
Microsoft Data Integration Pipelines: Azure Data Factory and SSISMicrosoft Data Integration Pipelines: Azure Data Factory and SSIS
Microsoft Data Integration Pipelines: Azure Data Factory and SSIS
 

Similar to Data Binding for Xamarin Forms In-Depth

Data Binding in Silverlight
Data Binding in SilverlightData Binding in Silverlight
Data Binding in SilverlightBoulos Dib
 
Data Binding and Data Grid View Classes
Data Binding and Data Grid View ClassesData Binding and Data Grid View Classes
Data Binding and Data Grid View ClassesArvind Krishnaa
 
Flex3 data binding
Flex3 data bindingFlex3 data binding
Flex3 data bindingguestdf3003
 
Vaadin JPAContainer
Vaadin JPAContainerVaadin JPAContainer
Vaadin JPAContainercmkandemir
 
Data Virtualization Primer -
Data Virtualization Primer -Data Virtualization Primer -
Data Virtualization Primer -Kenneth Peeples
 
Data binding in silverlight
Data binding in silverlightData binding in silverlight
Data binding in silverlightmsarangam
 
Data binding in silverlight
Data binding in silverlightData binding in silverlight
Data binding in silverlightmsarangam
 
WPF DATA BINDING CHEATSHEET V1.1
WPF DATA BINDING CHEATSHEET V1.1WPF DATA BINDING CHEATSHEET V1.1
WPF DATA BINDING CHEATSHEET V1.1Vikas Pandey
 
Advance Webpage Devlopment .NET
Advance Webpage Devlopment .NETAdvance Webpage Devlopment .NET
Advance Webpage Devlopment .NETPandeyABHISHEK1
 
Introduction to XAML and its features
Introduction to XAML and its featuresIntroduction to XAML and its features
Introduction to XAML and its featuresAbhishek Sur
 
Dependency property
Dependency propertyDependency property
Dependency propertymsarangam
 
Xamarin Forms - Noob to master - Week 2
Xamarin Forms - Noob to master - Week 2Xamarin Forms - Noob to master - Week 2
Xamarin Forms - Noob to master - Week 2Charlin Agramonte
 
L2s 090701234157 Phpapp02
L2s 090701234157 Phpapp02L2s 090701234157 Phpapp02
L2s 090701234157 Phpapp02google
 
Syntactic Mediation in Grid and Web Service Architectures
Syntactic Mediation in Grid and Web Service ArchitecturesSyntactic Mediation in Grid and Web Service Architectures
Syntactic Mediation in Grid and Web Service ArchitecturesMartin Szomszor
 

Similar to Data Binding for Xamarin Forms In-Depth (20)

Data Binding in Silverlight
Data Binding in SilverlightData Binding in Silverlight
Data Binding in Silverlight
 
Data Binding and Data Grid View Classes
Data Binding and Data Grid View ClassesData Binding and Data Grid View Classes
Data Binding and Data Grid View Classes
 
KnockoutJS and MVVM
KnockoutJS and MVVMKnockoutJS and MVVM
KnockoutJS and MVVM
 
Flex3 data binding
Flex3 data bindingFlex3 data binding
Flex3 data binding
 
Silverlight Databinding
Silverlight DatabindingSilverlight Databinding
Silverlight Databinding
 
Event sourcing
Event sourcingEvent sourcing
Event sourcing
 
Vaadin JPAContainer
Vaadin JPAContainerVaadin JPAContainer
Vaadin JPAContainer
 
Lesson 05 Data Binding in WPF
Lesson 05 Data Binding in WPFLesson 05 Data Binding in WPF
Lesson 05 Data Binding in WPF
 
Knockout js session
Knockout js sessionKnockout js session
Knockout js session
 
Data Virtualization Primer -
Data Virtualization Primer -Data Virtualization Primer -
Data Virtualization Primer -
 
dvprimer-concepts
dvprimer-conceptsdvprimer-concepts
dvprimer-concepts
 
Data binding in silverlight
Data binding in silverlightData binding in silverlight
Data binding in silverlight
 
Data binding in silverlight
Data binding in silverlightData binding in silverlight
Data binding in silverlight
 
WPF DATA BINDING CHEATSHEET V1.1
WPF DATA BINDING CHEATSHEET V1.1WPF DATA BINDING CHEATSHEET V1.1
WPF DATA BINDING CHEATSHEET V1.1
 
Advance Webpage Devlopment .NET
Advance Webpage Devlopment .NETAdvance Webpage Devlopment .NET
Advance Webpage Devlopment .NET
 
Introduction to XAML and its features
Introduction to XAML and its featuresIntroduction to XAML and its features
Introduction to XAML and its features
 
Dependency property
Dependency propertyDependency property
Dependency property
 
Xamarin Forms - Noob to master - Week 2
Xamarin Forms - Noob to master - Week 2Xamarin Forms - Noob to master - Week 2
Xamarin Forms - Noob to master - Week 2
 
L2s 090701234157 Phpapp02
L2s 090701234157 Phpapp02L2s 090701234157 Phpapp02
L2s 090701234157 Phpapp02
 
Syntactic Mediation in Grid and Web Service Architectures
Syntactic Mediation in Grid and Web Service ArchitecturesSyntactic Mediation in Grid and Web Service Architectures
Syntactic Mediation in Grid and Web Service Architectures
 

More from Alejandro Ruiz Varela

Shapes Brief - .NET Conf Latinoamérica 2020
Shapes Brief - .NET Conf Latinoamérica 2020Shapes Brief - .NET Conf Latinoamérica 2020
Shapes Brief - .NET Conf Latinoamérica 2020Alejandro Ruiz Varela
 
.NET Conf 2019 updates for Mobile Developers
.NET Conf 2019 updates for Mobile Developers.NET Conf 2019 updates for Mobile Developers
.NET Conf 2019 updates for Mobile DevelopersAlejandro Ruiz Varela
 
Deep Dive into Xamarin.Forms Shell @ Xamarin Summit Brasil 2019
Deep Dive into Xamarin.Forms Shell @ Xamarin Summit Brasil 2019Deep Dive into Xamarin.Forms Shell @ Xamarin Summit Brasil 2019
Deep Dive into Xamarin.Forms Shell @ Xamarin Summit Brasil 2019Alejandro Ruiz Varela
 
Mobile Machine Learning Made Easy with Azure Custom Vision @ Microsoft Ignite...
Mobile Machine Learning Made Easy with Azure Custom Vision @ Microsoft Ignite...Mobile Machine Learning Made Easy with Azure Custom Vision @ Microsoft Ignite...
Mobile Machine Learning Made Easy with Azure Custom Vision @ Microsoft Ignite...Alejandro Ruiz Varela
 
2019 .NET Mobile Development Hot Topics
2019 .NET Mobile Development Hot Topics2019 .NET Mobile Development Hot Topics
2019 .NET Mobile Development Hot TopicsAlejandro Ruiz Varela
 
Unotalks - The Future of Xamarin.Forms
Unotalks - The Future of Xamarin.FormsUnotalks - The Future of Xamarin.Forms
Unotalks - The Future of Xamarin.FormsAlejandro Ruiz Varela
 
Uso de Librerías Objective-c en Xamarin.iOS
Uso de Librerías Objective-c en Xamarin.iOSUso de Librerías Objective-c en Xamarin.iOS
Uso de Librerías Objective-c en Xamarin.iOSAlejandro Ruiz Varela
 
Uso de librerías Java en Xamarin.Android
Uso de librerías Java en Xamarin.AndroidUso de librerías Java en Xamarin.Android
Uso de librerías Java en Xamarin.AndroidAlejandro Ruiz Varela
 
Effects & Custom Renderers en Xamarin.Forms
Effects & Custom Renderers en Xamarin.FormsEffects & Custom Renderers en Xamarin.Forms
Effects & Custom Renderers en Xamarin.FormsAlejandro Ruiz Varela
 
Connected & Disconnected Apps With Azure Mobile Apps
Connected & Disconnected Apps With Azure Mobile AppsConnected & Disconnected Apps With Azure Mobile Apps
Connected & Disconnected Apps With Azure Mobile AppsAlejandro Ruiz Varela
 
"Cycle 8, Android Nougat & iOS 10" for Monkeys
"Cycle 8, Android Nougat & iOS 10" for Monkeys"Cycle 8, Android Nougat & iOS 10" for Monkeys
"Cycle 8, Android Nougat & iOS 10" for MonkeysAlejandro Ruiz Varela
 
Xamarin.Android + Arduino : Hacking Robots
Xamarin.Android + Arduino : Hacking RobotsXamarin.Android + Arduino : Hacking Robots
Xamarin.Android + Arduino : Hacking RobotsAlejandro Ruiz Varela
 

More from Alejandro Ruiz Varela (20)

Shapes Brief - .NET Conf Latinoamérica 2020
Shapes Brief - .NET Conf Latinoamérica 2020Shapes Brief - .NET Conf Latinoamérica 2020
Shapes Brief - .NET Conf Latinoamérica 2020
 
Primer vistazo a .NET MAUI
Primer vistazo a .NET MAUIPrimer vistazo a .NET MAUI
Primer vistazo a .NET MAUI
 
Xamarin.Forms Advanced Topics
Xamarin.Forms Advanced TopicsXamarin.Forms Advanced Topics
Xamarin.Forms Advanced Topics
 
.NET Conf 2019 updates for Mobile Developers
.NET Conf 2019 updates for Mobile Developers.NET Conf 2019 updates for Mobile Developers
.NET Conf 2019 updates for Mobile Developers
 
Deep Dive into Xamarin.Forms Shell @ Xamarin Summit Brasil 2019
Deep Dive into Xamarin.Forms Shell @ Xamarin Summit Brasil 2019Deep Dive into Xamarin.Forms Shell @ Xamarin Summit Brasil 2019
Deep Dive into Xamarin.Forms Shell @ Xamarin Summit Brasil 2019
 
Mobile Machine Learning Made Easy with Azure Custom Vision @ Microsoft Ignite...
Mobile Machine Learning Made Easy with Azure Custom Vision @ Microsoft Ignite...Mobile Machine Learning Made Easy with Azure Custom Vision @ Microsoft Ignite...
Mobile Machine Learning Made Easy with Azure Custom Vision @ Microsoft Ignite...
 
2019 .NET Mobile Development Hot Topics
2019 .NET Mobile Development Hot Topics2019 .NET Mobile Development Hot Topics
2019 .NET Mobile Development Hot Topics
 
Unotalks - The Future of Xamarin.Forms
Unotalks - The Future of Xamarin.FormsUnotalks - The Future of Xamarin.Forms
Unotalks - The Future of Xamarin.Forms
 
DevNights Xamarin: Custom Renderers
DevNights Xamarin: Custom RenderersDevNights Xamarin: Custom Renderers
DevNights Xamarin: Custom Renderers
 
Servicios cognitivos
Servicios cognitivosServicios cognitivos
Servicios cognitivos
 
Aplicaciones conectadas con Azure
Aplicaciones conectadas con AzureAplicaciones conectadas con Azure
Aplicaciones conectadas con Azure
 
Uso de Librerías Objective-c en Xamarin.iOS
Uso de Librerías Objective-c en Xamarin.iOSUso de Librerías Objective-c en Xamarin.iOS
Uso de Librerías Objective-c en Xamarin.iOS
 
2017 xamarin
2017 xamarin2017 xamarin
2017 xamarin
 
Uso de librerías Java en Xamarin.Android
Uso de librerías Java en Xamarin.AndroidUso de librerías Java en Xamarin.Android
Uso de librerías Java en Xamarin.Android
 
Effects & Custom Renderers en Xamarin.Forms
Effects & Custom Renderers en Xamarin.FormsEffects & Custom Renderers en Xamarin.Forms
Effects & Custom Renderers en Xamarin.Forms
 
Xamarin forms + Facebook
Xamarin forms + FacebookXamarin forms + Facebook
Xamarin forms + Facebook
 
Connected & Disconnected Apps With Azure Mobile Apps
Connected & Disconnected Apps With Azure Mobile AppsConnected & Disconnected Apps With Azure Mobile Apps
Connected & Disconnected Apps With Azure Mobile Apps
 
"Cycle 8, Android Nougat & iOS 10" for Monkeys
"Cycle 8, Android Nougat & iOS 10" for Monkeys"Cycle 8, Android Nougat & iOS 10" for Monkeys
"Cycle 8, Android Nougat & iOS 10" for Monkeys
 
Xamarin.Android + Arduino : Hacking Robots
Xamarin.Android + Arduino : Hacking RobotsXamarin.Android + Arduino : Hacking Robots
Xamarin.Android + Arduino : Hacking Robots
 
Introduction to xamarin
Introduction to xamarinIntroduction to xamarin
Introduction to xamarin
 

Recently uploaded

Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Product School
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backElena Simperl
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...Product School
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
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 2024Tobias Schneck
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsPaul Groth
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...Product School
 
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...Jeffrey Haguewood
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...Sri Ambati
 
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 PlanningIES VE
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Thierry Lestable
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
 
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 2DianaGray10
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Alison B. Lowndes
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 

Recently uploaded (20)

Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
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 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
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...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
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
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
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
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 

Data Binding for Xamarin Forms In-Depth

  • 1.
  • 2.
  • 4. Data Binding Data binding is the technique of linking properties of two objects so that changes in one property are automatically reflected in the other property. Data binding is an integral part of the Model-View- ViewModel (MVVM) application architecture.
  • 6. Basic Bindings A Xamarin.Forms data binding links a pair of properties between two objects, at least one of which is usually a user-interface object. These two objects are called the target and the source: • The target is the object (and property) on which the data binding is set. • The source is the object (and property) referenced by the data binding.
  • 7.
  • 9. Binding Mode Allow to set the behavior of each data binding, the available options in Xamarin.Forms are: • Default • TwoWay – data goes both ways between source and target • OneWay – data goes from source to target • OneWayToSource – data goes from target to source • OneTime – data goes from source to target, but only when the BindingContext changes (>=Xamarin.Forms 3.0) **Each property has his own default binding mode**
  • 10.
  • 12. String Formatting Sometimes it's convenient to use data bindings to display the string representation of an object or value. For example, you might want to use a Label to display the current value of a Slider. In this data binding, the Slider is the source, and the target is the Text property of the Label.
  • 13.
  • 15. Binding Path The Path property of the Binding class (or the Path property of the Binding markup extension) has been set to a single property. It's actually possible to set Path to a sub-property (a property of a property), or to a member of a collection.
  • 16.
  • 18. Binding Value Converters Data bindings usually transfer data from a source property to a target property, and in some cases from the target property to the source property. This transfer is straightforward when the source and target properties are of the same type, or when one type can be converted to the other type through an implicit conversion. When that is not the case, a type conversion must take place.
  • 19.
  • 21. Relative Bindings Relative bindings provide the ability to set the binding source relative to the position of the binding target. They are created with the RelativeSource markup extension, and set as the Source property of a binding expression. The RelativeSource markup extension is supported by the RelativeSourceExtension class, which defines the following properties: • Mode • AncestorLevel • AncestorType
  • 22. Relative Bindings Modes: • TemplatedParent indicates the element to which the template, in which the bound element exists, is applied. • Self indicates the element on which the binding is being set, allowing you to bind one property of that element to another property on the same element. • FindAncestor indicates the ancestor in the visual tree of the bound element. • FindAncestorBindingContext indicates the BindingContext of the ancestor in the visual tree of the bound element.
  • 23.
  • 25. Binding Fallbacks Sometimes data bindings fail, because the binding source can't be resolved, or because the binding succeeds but returns a nullvalue. Two options are available: • FallbackValue: allows a fallback value to be defined that will be used when the binding source can't be resolved. • TargetNullValue: allows a replacement value to be defined that will be used when the binding source is resolved, but the value is null.
  • 26.
  • 28. Compiled Bindings Compiled bindings improve data binding performance in Xamarin.Forms applications by resolving binding expressions at compile-time rather than runtime. In addition, this compile-time validation of binding expressions enables a better developer troubleshooting experience because invalid bindings are reported as build errors. The process for using compiled bindings is to: • Enable XAML compilation. For more information about XAML compilation, see XAML Compilation. • Set an x:DataType attribute on a VisualElement to the type of the object that the VisualElement and its children will bind to.
  • 29.
  • 30.
  • 31.
  • 32.