Can we use multiple ViewModel for same usercontrol WPF #3263
Answered
by
ChrisPulman
rajeshwaranpj
asked this question in
Q&A
-
IViewFor allows using a ViewModel to be rendered for that associated view. Is it possible to render the same user control for different ViewModels? Currently using this implementation below for example which registers one View to one ViewModel
|
Beta Was this translation helpful? Give feedback.
Answered by
ChrisPulman
Feb 3, 2025
Replies: 1 comment
-
Hi, you can register multiple ViewModel's with the same common Interface, then register them individually decaring the context for each registration, you can then get the relevant ViewModel by passing the various context values to the Locator to retrieve your required ViewModel. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ChrisPulman
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, you can register multiple ViewModel's with the same common Interface, then register them individually decaring the context for each registration, you can then get the relevant ViewModel by passing the various context values to the Locator to retrieve your required ViewModel.