If I have a MultiPresenter
and I am using a ListBox
to display the Presenters
it is hosting, how do I get Caliburn to discover and bind the views and view models for the items?
For example, if I have a simple view that looks something like this:
<UserControl x:Class="MyProject.Views.CarView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<ListBox ItemsSource="{Binding Parts}" />
</Grid>
</UserControl>
Which is bound to the CarViewModel
:
public class CarViewModel : MultiPresenter
{
public BindableCollection<IPartViewModel> Parts { get; }
}
And the Parts
collection contains various objects that implement IPresenter
and have corresponding views, e.g. WheelViewModel
and WheelView
, and EngineViewModel
and EngineView
.
I'd like Caliburn to resolve the views for me using the view strategy. Is this possible? What do I need to do to correctly set up the hierarchy of presenters in this case?