SlideShare a Scribd company logo
The Secret Sauce Behind
{Binding} in XAML
Brendon Page
{Overview}
• What is binding
• Why is it difficult
• Adding some Context
• Behind the scenes
{What Is It}
DataUI
textBox.Text = Value;
Value = textBox.Text;
<TextBox Text="{Binding}" />
• Mechanism for interacting with data.
• Display, convert, update data
{Quick Demo}
{Difficult}
• There’s a lot of other things you need to know
– DependencyObject /DependencyProperty
– INotifyPropertyChanged / INotifyCollectionChanged
– IValueConverter
• Cryptic debugging feedback
• It’s abstract
– MSDN (WPF) Overview
• More than 7500 words
• 12 Images
• 20 Code blocks
{A lot to know}
• All errors are shown in the output window
• When data source is set
– System.Windows.Data Error: 40 : BindingExpression path error: 'Name'
property not found on 'object' ''Person' (HashCode=46763000)'.
BindingExpression:Path=Name; DataItem='Person' (HashCode=46763000);
target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')
• When data source isn’t set
–
{Debugging}
{Quick Demo}
{Context}
<Window>
<TextBox Text="{Binding Path=Name}" />
</Window >
public sealed partial class MainWindow : Window
{
public MainPage()
{
DataContext = new Person { Name = "Brendon" };
}
}
XAML
C# DataContext
Binding Uses
As it’s default datasource
Cascadesdown
{Just an Object}
<TextBox Text="{Binding Path=Name}" />
XAML
TextBox textBox = new TextBox();
C#
Binding binding = new Binding("Name");
textBox.SetBinding(TextBox.TextProperty, binding);
textBox.Text = binding;
Design Time
{But Wait There’s More}
Runtime
• Does the work
• Read & writes data between
source & target
• Subscribes to property changed events
• Maintains the relationship
• Describes the binding,
Source, Target, DataItem,
Path, Mode
{Conclusion}
• Interact with data
• Binding is tricky, until you understand it
• Context is important
• It’s just an object

More Related Content

PPTX
XAML Data Binding in UWP
PDF
Save your data
PPTX
OData – Super Cola W3
PPTX
Quick start guide to java script frameworks for sharepoint add ins oslo
PPTX
HTML5
PPTX
MVVM Magic in SharePoint 2010 using Knockoutjs!
PPTX
Html5 101
PPTX
How my team is applying JS framework for PHP projects.
XAML Data Binding in UWP
Save your data
OData – Super Cola W3
Quick start guide to java script frameworks for sharepoint add ins oslo
HTML5
MVVM Magic in SharePoint 2010 using Knockoutjs!
Html5 101
How my team is applying JS framework for PHP projects.

What's hot (9)

PPTX
Streaming Data Pipelines with MongoDB and Kafka at ao.com
PPTX
Quick start guide to java script frameworks for sharepoint apps spsbe-2015
PDF
Introduction to html & css
PPTX
Intoduction to OrientDB
PPTX
Knockoutjs Part 4 Bindings Controlling text and appearance
PPTX
Progressive Web Apps Nedir? JavaScript Service Workers Nedir?
PPTX
Microsoft Web Matrix
PPTX
Html5 local storage
PPTX
Notes on SF W3Conf
Streaming Data Pipelines with MongoDB and Kafka at ao.com
Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Introduction to html & css
Intoduction to OrientDB
Knockoutjs Part 4 Bindings Controlling text and appearance
Progressive Web Apps Nedir? JavaScript Service Workers Nedir?
Microsoft Web Matrix
Html5 local storage
Notes on SF W3Conf
Ad

Similar to The secret sauce behind {binding} in xaml (20)

PPTX
Silverlight week5
PPTX
Data Binding for Xamarin Forms In-Depth
PPTX
Xaml programming
KEY
WPF Binding
PDF
WPF DATA BINDING CHEATSHEET V1.1
PDF
Data Binding in Silverlight
PPT
Simple Data Binding
PPTX
Lesson 05 Data Binding in WPF
PDF
Data Binding and Data Grid View Classes
PPTX
Imagine Camp Algeria 2014 Build for both session2 mvvm
PPTX
Data Bondage in WPF
PPT
Dev308
PPTX
WPF - Controls &amp; Data
PPTX
Meetup - Getting Started with MVVM Light for WPF - 11 may 2019
PPT
Data Binding In Depth
PPT
Flex data binding pitfalls: 10 common misuses and mistakes
PPTX
Advance Webpage Devlopment .NET
PPTX
Data binding in silverlight
PPTX
Data binding in silverlight
PDF
Xamarin Forms - Noob to master - Week 2
Silverlight week5
Data Binding for Xamarin Forms In-Depth
Xaml programming
WPF Binding
WPF DATA BINDING CHEATSHEET V1.1
Data Binding in Silverlight
Simple Data Binding
Lesson 05 Data Binding in WPF
Data Binding and Data Grid View Classes
Imagine Camp Algeria 2014 Build for both session2 mvvm
Data Bondage in WPF
Dev308
WPF - Controls &amp; Data
Meetup - Getting Started with MVVM Light for WPF - 11 may 2019
Data Binding In Depth
Flex data binding pitfalls: 10 common misuses and mistakes
Advance Webpage Devlopment .NET
Data binding in silverlight
Data binding in silverlight
Xamarin Forms - Noob to master - Week 2
Ad

More from brendonpage (8)

PPTX
Build the Roof First
PPTX
Applying big data thinking to normal size data
PPTX
Lean outside in software development
PPTX
Delivering Technical Debt
PPTX
String kata in 20 minutes
PPTX
Connect and search your data
PPTX
Information radiators
PPTX
Delivering technical debt
Build the Roof First
Applying big data thinking to normal size data
Lean outside in software development
Delivering Technical Debt
String kata in 20 minutes
Connect and search your data
Information radiators
Delivering technical debt

Recently uploaded (20)

PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PPTX
Patient Appointment Booking in Odoo with online payment
PPTX
history of c programming in notes for students .pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Cost to Outsource Software Development in 2025
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PDF
AutoCAD Professional Crack 2025 With License Key
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
L1 - Introduction to python Backend.pptx
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
Nekopoi APK 2025 free lastest update
PDF
Complete Guide to Website Development in Malaysia for SMEs
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Monitoring Stack: Grafana, Loki & Promtail
wealthsignaloriginal-com-DS-text-... (1).pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
Patient Appointment Booking in Odoo with online payment
history of c programming in notes for students .pptx
Odoo Companies in India – Driving Business Transformation.pdf
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Cost to Outsource Software Development in 2025
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
AutoCAD Professional Crack 2025 With License Key
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Navsoft: AI-Powered Business Solutions & Custom Software Development
L1 - Introduction to python Backend.pptx
Salesforce Agentforce AI Implementation.pdf
iTop VPN Free 5.6.0.5262 Crack latest version 2025
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Nekopoi APK 2025 free lastest update
Complete Guide to Website Development in Malaysia for SMEs
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf

The secret sauce behind {binding} in xaml

  • 1. The Secret Sauce Behind {Binding} in XAML Brendon Page
  • 2. {Overview} • What is binding • Why is it difficult • Adding some Context • Behind the scenes
  • 3. {What Is It} DataUI textBox.Text = Value; Value = textBox.Text; <TextBox Text="{Binding}" /> • Mechanism for interacting with data. • Display, convert, update data
  • 5. {Difficult} • There’s a lot of other things you need to know – DependencyObject /DependencyProperty – INotifyPropertyChanged / INotifyCollectionChanged – IValueConverter • Cryptic debugging feedback • It’s abstract – MSDN (WPF) Overview • More than 7500 words • 12 Images • 20 Code blocks
  • 6. {A lot to know}
  • 7. • All errors are shown in the output window • When data source is set – System.Windows.Data Error: 40 : BindingExpression path error: 'Name' property not found on 'object' ''Person' (HashCode=46763000)'. BindingExpression:Path=Name; DataItem='Person' (HashCode=46763000); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String') • When data source isn’t set – {Debugging}
  • 9. {Context} <Window> <TextBox Text="{Binding Path=Name}" /> </Window > public sealed partial class MainWindow : Window { public MainPage() { DataContext = new Person { Name = "Brendon" }; } } XAML C# DataContext Binding Uses As it’s default datasource Cascadesdown
  • 10. {Just an Object} <TextBox Text="{Binding Path=Name}" /> XAML TextBox textBox = new TextBox(); C# Binding binding = new Binding("Name"); textBox.SetBinding(TextBox.TextProperty, binding); textBox.Text = binding;
  • 11. Design Time {But Wait There’s More} Runtime • Does the work • Read & writes data between source & target • Subscribes to property changed events • Maintains the relationship • Describes the binding, Source, Target, DataItem, Path, Mode
  • 12. {Conclusion} • Interact with data • Binding is tricky, until you understand it • Context is important • It’s just an object

Editor's Notes

  • #4: How you’d do it manually. Notice how NO value is specified.
  • #6: Abstract? Code path isn’t clear unless you know how it works.
  • #7: Just to give you an idea of the “other” things you need to know.
  • #11: Take a look at what happening behind the scenes. Markup extension.