I have a UserControl
that contains - among other things - a ListView
. The ListView
has a different data context than the UserControl
(this data context is not exposed). If someone consumes my control, I would like them to be able to (indirectly) bind to the ListView
's ItemsSource
dependency property. It should really feel like the user is binding to a typical ItemsSource
.
I'm not sure what the best way to proceed is. Looking at how ItemsControl
's ItemsSource
property worked in Reflector showed some logic that seemed a bit more involved than ought to be necessary for simple forwarding.
My current best idea is to expose a collection as a dependency property on the outer control and, when it is updated, update the ListView
's ItemsSource
. But I'm not sure what type this collection should be (should I require an ObservableCollection<T>
, for example), or if there are any gotchas I should look out for.
Any suggestions or advice would be much appreciated.
Thanks.