IUrlLocator

Name Value
Assembly Catel.MVVM
Namespace Catel.MVVM
Available on .NET Framework 4.5, .NET Framework 4.6, Xamarin - Android, Xamarin - iOS
public interface IUrlLocator : ILocator

Implements interfaces ILocator

Resolver that will resolve view types based on the view model type. For example, if a view model with the type nameMyAssembly.ViewModels.PersonViewModel is inserted, this could result in the view typeMyAssembly.Views.PersonView.

Methods

Register(Type viewModelType, string url)

Registers the specified url in the local cache. This cache will also be used by the Boolean) method.

Parameters

Name Description
viewModelType The view model to resolve the url for.
url The resolved url.

Exceptions

Name Description
ArgumentNullException The viewModelType isnull.
ArgumentException The url isnull or whitespace.

ResolveUrl(Type viewModelType, bool ensurePageExists)

Resolves an url by the view model and the registered NamingConventions.

Parameters

Name Description
viewModelType Type of the view model to resolve the url for.
ensurePageExists if set totrue, the method checks whether the page resource actually exists.

Returns

The resolved viurlew ornull if the view could not be resolved.

Exceptions

Name Description
ArgumentNullException The viewModelType isnull.

Remarks

Keep in mind that all results are cached. The cache itself is not automatically cleared when the NamingConventions are changed. If the NamingConventions are changed, the cache must be cleared manually.


Have a question about Catel? Use StackOverflow with the Catel tag!


Discussion