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
0
4.9k
Data Bind Everything
Talk given at NDC London December 4th 2013
Stuart Lodge
December 04, 2013
Tweet
Share
More Decks by Stuart Lodge
See All by Stuart Lodge
Future Decoded - VisualStudio and Xamarin talk
cirrious
0
200
MvvmCross - Presentation to BCS Edinburgh
cirrious
0
170
MobDevCon MvvmCross Workshop
cirrious
0
3.3k
Static Version of MvvmCross Evolve talk
cirrious
0
120
Jago?
cirrious
0
150
Presenters in MvvmCross
cirrious
1
32k
Saying SOLID with PCL
cirrious
0
3.4k
Using SQLite.Net In MvvmCross
cirrious
0
1.1k
AppStart in MvvmCross
cirrious
2
3k
Other Decks in Technology
See All in Technology
0→1事業こそPMは営業すべし / pmconf #落選お披露目 / PM should do sales in zero to one
roki_n_
PRO
1
750
🌏丸い地球を効率的に平たくする 〜🗺️地図の幾何学とWeb地図技術〜
syotasasaki593876
0
140
完全自律型AIエージェントとAgentic Workflow〜ワークフロー構築という現実解
pharma_x_tech
0
310
PaaSの歴史と、 アプリケーションプラットフォームのこれから
jacopen
7
1.1k
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
6
54k
自社 200 記事を元に整理した読みやすいテックブログを書くための Tips 集
masakihirose
2
310
Docker Desktop で Docker を始めよう
zembutsu
PRO
0
140
Goで実践するBFP
hiroyaterui
1
110
.NET 最新アップデート ~ AI とクラウド時代のアプリモダナイゼーション
chack411
0
190
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!事例のご紹介+座学②
siyuanzh09
0
110
デジタルアイデンティティ技術 認可・ID連携・認証 応用 / 20250114-OIDF-J-EduWG-TechSWG
oidfj
2
520
あなたの人生も変わるかも?AWS認定2つで始まったウソみたいな話
iwamot
3
810
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
YesSQL, Process and Tooling at Scale
rocio
170
14k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
860
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
173
50k
Become a Pro
speakerdeck
PRO
26
5.1k
Documentation Writing (for coders)
carmenintech
67
4.5k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Writing Fast Ruby
sferik
628
61k
The Invisible Side of Design
smashingmag
299
50k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
Docker and Python
trallard
43
3.2k
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