Hi, I recently came across an answer on stackoverflow that kinda made me think about, whether or not a UserControl should have a viewmodel.
For example i have a TabControl, and each is hooked up to a UserControl. As is, i have made a Viewmodel for each of those UserControls. However, is this infact a code smell and therefore should be avoided, or is it not?
I searched around a little, and most of what i could find was the same guy (or so i assume from what he wrote) so i have no idea where he got this from.
Should i refactor my code and 'combine' the Viewmodels into one. This would sertaintly help with a specific problem i'm having, where i need all viewmodels to see the same ObservableCollection<T>.
it might make sense to do the above, and yet the viewmodel that would have to contain the 4 viewmodels i've got going, would get pretty big (Tabcontrol that has 3 tabitems, each with a user control + VM, and the main one.) Also, if it's a codesmell i kinda don't wanna do it 😡
Note: I actually recently started working with C# and WPF – comming from a Powershell / Lua background.
What are other mvvm / WPF specific code smells you've encountered?
So whats the popular opinion on this?
by Slackerony via /r/csharp