private IView CreateItem(object model)
{
// Defer to the externally set ItemFactory if there is one.
if (ItemFactory != null) return ItemFactory(model);
// No item factory, check if the model can create views itself.
IViewFactory viewFactory = model as IViewFactory;
if (viewFactory != null) return viewFactory.CreateView();
// Create the default list-item control.
return new ListItemView(model);
}