diff --git a/src/Uno.Extensions.Navigation.UI/RouteResolverDefault.cs b/src/Uno.Extensions.Navigation.UI/RouteResolverDefault.cs index 7b7e8b8262..c80e9ca16c 100644 --- a/src/Uno.Extensions.Navigation.UI/RouteResolverDefault.cs +++ b/src/Uno.Extensions.Navigation.UI/RouteResolverDefault.cs @@ -8,7 +8,7 @@ public class RouteResolverDefault : RouteResolver public string[] ViewSuffixes { get; set; } = new[] { "View", "Page", "Control", "Flyout", "Dialog", "Popup" }; - public string[] ViewModelSuffixes { get; set; } = new[] { "ViewModel", "VM" }; + public string[] ViewModelSuffixes { get; set; } = new[] { "Model", "ViewModel", "VM" }; private IDictionary? loadedTypes; @@ -189,12 +189,17 @@ private string TrimSuffices(string? path, IEnumerable suffixes) return string.Empty; } + var best = path; foreach (var item in suffixes) { - path = path.TrimEnd(item, StringComparison.InvariantCultureIgnoreCase); + var candidate = path.TrimEnd(item, StringComparison.InvariantCultureIgnoreCase); + if (candidate.Length < best.Length) + { + best = candidate; + } } - return path; + return best; } public IDictionary LoadedTypes