-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
The documentation for IViewLocator.ResolveViewFor<T> describes the return value as:
/// <returns>The view, with the ViewModel property assigned to
/// viewModel.</returns>Given this, one would expect that when resolving a view with the default view locator via ViewLocator.Current.ResolveView(viewModel) the returned view would have the provided viewModel assigned to its ViewModel property. However this isn't the case as the DefaultViewLocator.ResolveViewFor<T> does not ever assign the provided viewModel to the view's ViewModel property.
Granted, the documentation for DefaultViewLocator.ResolveViewFor<T> doesn't mention that it will assign the view's ViewModel property and this could be the expected behavior for the DefaultViewLocator. It's just a bit confusing to have the documentation for IViewLocator.ResolveViewFor<T> claiming that the provided viewModel will be assigned to the view's ViewModel property and then have the DefaultViewLocator.ResolveViewFor<T> implementation not actually do that.
Steps To Reproduce
- Create a view model instance (
viewModel). - Call
ViewLocator.Current.ResolveView(viewModel)to get the view for theviewModel. - Observe that the returned view's
ViewModelproperty has not been set.
Expected behavior
The view returned by the ViewLocator.Current.ResolveView(viewModel) call should have its ViewModel property set to the provided viewModel.
Or, the documentation for IViewLocator.ResolveView<T> should not state the ViewModel property will be set.
Environment
- OS: Windows 10
- Version: 2004
- Device: PC