how to avoid ViewModelViewHost fallingl back to Locate View without constract #3712
Closed
newbienewbie
started this conversation in
General
Replies: 1 comment
-
Adding a property is definitely a possibility as long as it defaults to the current fallback technique so not to break existing users that rely on it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Senario
I have multiple different views that share the same ViewModel.
I only defined the ViewModel (e.g.
WaitingFunVM
) and let those views defined by other developers. The other developers provide user-defined views in plugins. And finally I locate the related views by a contract:Normally, it will render the
ViewB
without any problem.However, in some case, the
ViewB
implementation is optional: Plugins author might not implement the ViewB at all.What I want is that it should show nothing instead of rending
ViewA
if a specifyViewContract="ConstractB"
.The Current Implementation
The current implementation of
ViewModelViewHost
resolves the View in the following way:It means the current implementation falls back to resolve view with no
contract
if nothing found.If the
ResolveViewForViewModel()
must not beprotect virtual
, is it possible add a property so that we can bypass the fallback toviewLocator.ResolveView(viewModel);
?e.g. :
Beta Was this translation helpful? Give feedback.
All reactions