Automatically configure ItemsControl if it's bound #146

merged 9 commits into from Jan 3, 2013


None yet
1 participant

paulcbetts commented Jan 3, 2013


If you bind to an ItemsControl and have bought into RxUI Routing, nearly every ItemsControl (i.e. ListBox, etc etc), every DataTemplate will be exactly the same, just an instance of ViewModelViewHost. So, why not just do it for them if they haven't set a Data Template?


This PR adds a new feature to ReactiveUI, called "Binding Hooks". This feature allows you to register a method to be called whenever a Bind() and friends are called. We then use this new feature to recognize bindings that target ItemsControls and rig the DataTemplate.

paulcbetts added some commits Jan 2, 2013

Implement binding hooks
This feature allows developers to hook when binds happen and perform
arbitrary actions on either the ViewModel or View objects, as well as cancel
the Bind.
Make the programming model for binding hooks easier
The data that ExecuteHook gives you made it a total pain to actually
write useful hooks. Give the hook producer way more data, but only
produce it if asked, since it's (relatively) expensive.

paulcbetts pushed a commit that referenced this pull request Jan 3, 2013

Paul Betts
Merge pull request #146 from reactiveui/auto-itemscontrol
Automatically configure ItemsControl if it's bound

@paulcbetts paulcbetts merged commit 1e7e359 into master Jan 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment