private static object GetActualView(object view)
{
if (view != null && !(view is IView))
{
var type = view.GetType();
var actualView = ViewContainer.GetExactView(type);
if (actualView == null)
{
var viewAttribute = type.GetCustomAttribute <ViewAttribute>();
if (viewAttribute != null)
{
actualView = viewAttribute.ViewType;
}
}
if (actualView != null)
{
var newView = Activator.CreateInstance(actualView);
var dc = newView as IDataContext <object>;
if (dc != null)
{
dc.DataContext = view;
}
return(newView);
}
}
return(view);
}