Fix Stylet.Samples.OverridingViewManager

This commit is contained in:
Antony Male 2014-05-26 19:09:10 +01:00
parent eeeb761e0d
commit ff2ca4deb2
1 changed files with 4 additions and 4 deletions

View File

@ -38,12 +38,12 @@ namespace Stylet.Samples.OverridingViewManager
this.viewModelToViewMapping = mappings.ToDictionary(x => x.ViewModel, x => x.View); this.viewModelToViewMapping = mappings.ToDictionary(x => x.ViewModel, x => x.View);
} }
public override UIElement CreateViewForModel(object model) protected override Type LocateViewForModel(Type modelType)
{ {
Type viewType; Type viewType;
if (!this.viewModelToViewMapping.TryGetValue(model.GetType(), out viewType)) if (!this.viewModelToViewMapping.TryGetValue(modelType, out viewType))
throw new Exception(String.Format("Could not find View for ViewModel {0}", model.GetType().Name)); throw new Exception(String.Format("Could not find View for ViewModel {0}", modelType.Name));
return (UIElement)IoC.GetInstance(viewType, null); return viewType;
} }
} }
} }