Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Data Bind Everything
Search
Stuart Lodge
December 04, 2013
Technology
5.1k
0
Share
Data Bind Everything
Talk given at NDC London December 4th 2013
Stuart Lodge
December 04, 2013
More Decks by Stuart Lodge
See All by Stuart Lodge
Future Decoded - VisualStudio and Xamarin talk
cirrious
0
240
MvvmCross - Presentation to BCS Edinburgh
cirrious
0
210
MobDevCon MvvmCross Workshop
cirrious
0
3.6k
Static Version of MvvmCross Evolve talk
cirrious
0
170
Jago?
cirrious
0
210
Presenters in MvvmCross
cirrious
1
32k
Saying SOLID with PCL
cirrious
0
3.7k
Using SQLite.Net In MvvmCross
cirrious
0
1.2k
AppStart in MvvmCross
cirrious
2
3.1k
Other Decks in Technology
See All in Technology
新規ゲーム開発におけるAI駆動開発のリアル
202409e2
0
1.2k
AIガバナンス実践 - 生成AIコネクタのデータ漏洩リスクと実務対策
knishioka
0
160
Claude Codeを組織で使いこなす— サーバサイドAIエージェント運用の実践知
techtekt
PRO
0
160
インフラが苦手でも大丈夫! 紙芝居 Kubernetes -WWGT 10周年編-
aoi1
1
320
ポスター発表&デモと総括 / Poster Presentations & Demonstrations and Summary
ks91
PRO
0
180
探して_入れて_作って_使う_Agent_Skills___LT.pdf
peintangos
2
150
Claude code Orchestra
ozakiomumkj
3
890
速さだけじゃない! VoidZero ツールが移行先に選ばれる理由
mizdra
PRO
6
730
製造業のクラウド活用最適解〜AI,DXを加速するデータ基盤の作り方〜
hamadakoji
0
260
サプライチェーンセキュリティの空白地帯 - 信頼できる”依存性”の未来を考える
rung
PRO
2
620
Cloud Run のアップデート 触ってみる&紹介
gre212
0
290
Oracle Cloud Infrastructure IaaS 新機能アップデート 2026/3 - 2026/5
oracle4engineer
PRO
1
100
Featured
See All Featured
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
330
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2k
Between Models and Reality
mayunak
4
320
Chasing Engaging Ingredients in Design
codingconduct
0
200
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
240
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
350
Speed Design
sergeychernyshev
33
1.8k
The Invisible Side of Design
smashingmag
302
52k
Evolving SEO for Evolving Search Engines
ryanjones
0
210
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
230
Transcript
@slodge Data-Bind Everything…
@slodge fun we’ve had extending data-binding in MvvmCross
@slodge MvvmCross
@slodge MvvmCross • C# • Microsoft, Xamarin and beyond! •
PCL • IoC • Convention-Based Mvvm • Data-Binding
@slodge MvvmCross • C# • Microsoft, Xamarin and beyond! •
PCL • IoC • Convention-Based Mvvm • Data-Binding
@slodge • Building a Data-Binding Engine • MvvmCross v1/v2 Data-Binding
• MvvmCross v3 - Rio and Tibet • The Dark Side?
@slodge • Building a Data-Binding Engine • MvvmCross v1/v2 Data-Binding
• MvvmCross v3 - Rio and Tibet • The Dark Side?
@slodge Data-Binding in Xaml/C#
@slodge Data-Binding in Xaml/C# ViewModel INotifyPropertyChanged Control TextProperty DependencyProperty DependencyObject
Values BindingOperations FirstName C# Property PropertyChanged C# Event
@slodge … in Android and iOS UIKit? ViewModel INotifyPropertyChanged Control
TextProperty DependencyProperty DependencyObject Values BindingOperations FirstName C# Property PropertyChanged C# Event
@slodge … in Android and iOS UIKit? ViewModel INotifyPropertyChanged Control
TextProperty DependencyProperty DependencyObject Values BindingOperations FirstName C# Property PropertyChanged C# Event Text TextChanged OurBindingEngine
@slodge What’s a Binding Engine do 1. Initially copy values
ViewModel -> View 2. When ViewModel changes, update View 3. When View changes, update ViewModel 4. Don’t loop! 5. When the View disappears, dispose the bindings
@slodge Creating a Binding Engine…
@slodge • Building a Data-Binding Engine • MvvmCross v1/v2 Data-Binding
• MvvmCross v3 - Rio and Tibet • The Dark Side?
@slodge … in Android and iOS UIKit? ViewModel INotifyPropertyChanged Control
TextProperty DependencyProperty DependencyObject Values BindingOperations FirstName C# Property PropertyChanged C# Event Text TextChanged MvxBindingEngine
@slodge Syntax – Xaml/C# Text=“ {Binding Customer.Gender, Converter={StaticResource FormalGreeting}, FallbackValue=‘Mr’}”
@slodge Syntax - Json { “Text”: { “Path”:”Customer.Gender”, “Converter”:”FormalGreeting”, “FallbackValue”:”Mr”
} }
@slodge Syntax – “Swiss” Text Customer.Gender, Converter=FormalGreeting, FallbackValue=’Mr’
@slodge Syntax - Fluent set.Bind(label) .For(t => t.Text) .To(vm =>
vm.Customer.Gender) .WithConversion(“FormalGreeting”) .WithFallback(“Mr”)
@slodge Binding Parts • Path • Mode • Converter •
ConverterParameter • FallbackValue
@slodge Path • Simple FirstName • Chained Customer.FirstName • Indexed
Customers[0].FirstName Customers[“Fred”].FirstName • Whole Object .
@slodge Mode • One Way • Two Way • One
Way To Source • One Time • … and Default
@slodge Converters
@slodge Converters • Basic Conversion • FallbackValue • UnsetValue •
DoNothing
@slodge Core Demos
@slodge Binding Targets • It just works TM • When
it doesn’t just work: – Inheritance – Intermediate – Custom Bindings
@slodge Inheritance Android.Views.View MyShapeView TheShape TheShapeChanged
@slodge Intermediate Map MapMarkerHelper ItemsSource
@slodge Custom binding Button “Favorite” CustomBinding OurBindingEngine
@slodge Composite Binding Sources • Collections • Commands • I18n
• Dialogs
@slodge Collections
@slodge Commands
@slodge Internationalisation
@slodge Dialogs View ViewModel Command fired Show confirmation “MessageBox” Yes/No
result
@slodge Dialogs
@slodge Composite Demos
@slodge • Building a Data-Binding Engine • MvvmCross v1/v2 Data-Binding
• MvvmCross v3 - Rio and Tibet • The Dark Side?
@slodge JavaScript envy • ko.observable • ko.computedValue • functions
@slodge Tibet Binding extensions • MultiBinding • Literals • +
- concatenation • Function-like ValueConversion • Recursive evaluation • ValueCombiners (MultiValueConverters) • If, Format, &&, ||, <, >, ==, …
@slodge Syntax – “Tibet”
@slodge Syntax – “Tibet”
@slodge Syntax – “Tibet”
@slodge Rio Extensions • Fody integration • Field Binding •
Method Bindings • Extensible – interfaces and plugins
@slodge Fody
@slodge Fody
@slodge Field Binding
@slodge Method Binding
@slodge All available in Xaml too
@slodge Tibet & Rio
@slodge • Building a Data-Binding Engine • MvvmCross v1/v2 Data-Binding
• MvvmCross v3 - Rio and Tibet • The Dark Side?
@slodge Benefits • Code sharing • Designer-friendly • Testability •
Coder friendly
@slodge Some gaps/differences? • RelativeSource • ElementName • Validation and
Trigger • Multi-Binding • ICommand
@slodge “Overkill” • For small throwaway apps…
@slodge The Call Stack
@slodge Performance everyone (at least, more or less experienced developer)
knows that reflection is performance's "evil".
@slodge "We should forget about small efficiencies, say about 97%
of the time: premature optimization is the root of all evil" Performance
@slodge Performance Analysis Simple UI test: – ViewModel: 10000 *
“Value = Value+1” – View: TextView bound “Text Value”
@slodge Performance Results Baseline 2116 OneWay 2378 INotifyChanged 2066 TwoWayBaseline
6216 TwoWay 7092
@slodge • Building a Data-Binding Engine • MvvmCross v1/v2 Data-Binding
• MvvmCross v3 - Rio and Tibet • The Dark Side?
@slodge Awesomeness
@slodge
@slodge Thanks for listening! https://github.com/mvvmcross https://github.com/reactiveUI https://github.com/MacawNL https://github.com/Fody @slodge @mvvmcross