Skip to content

Commit

Permalink
DeterminePackUriFromType only replaces assembly name when at start of…
Browse files Browse the repository at this point in the history
… view name. Resolves #124
  • Loading branch information
nigel-sampson committed Mar 10, 2015
1 parent aee507b commit bcfb6a2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Caliburn.Micro.Platform/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,23 +406,23 @@ public static void AddSubNamespaceMapping(string nsSource, string nsTarget, stri
public static Func<Type, Type, string> DeterminePackUriFromType = (viewModelType, viewType) => {
#if !WinRT
var assemblyName = viewType.Assembly.GetAssemblyName();
var uri = viewType.FullName.Replace(assemblyName, string.Empty).Replace(".", "/") + ".xaml";

if(!Application.Current.GetType().Assembly.GetAssemblyName().Equals(assemblyName)) {
return "/" + assemblyName + ";component" + uri;
}

return uri;
var applicationAssemblyName = Application.Current.GetType().Assembly.GetAssemblyName();
#else
var assemblyName = viewType.GetTypeInfo().Assembly.GetAssemblyName();
var uri = viewType.FullName.Replace(assemblyName, string.Empty).Replace(".", "/") + ".xaml";
var applicationAssemblyName = Application.Current.GetType().GetTypeInfo().Assembly.GetAssemblyName();
#endif
var viewTypeName = viewType.FullName;

if (viewTypeName.StartsWith(assemblyName))
viewTypeName = viewTypeName.Substring(assemblyName.Length);

if (!Application.Current.GetType().GetTypeInfo().Assembly.GetAssemblyName().Equals(assemblyName)) {
var uri = viewTypeName.Replace(".", "/") + ".xaml";

if(!applicationAssemblyName.Equals(assemblyName)) {
return "/" + assemblyName + ";component" + uri;
}

return uri;
#endif
};

/// <summary>
Expand Down

0 comments on commit bcfb6a2

Please sign in to comment.