I was thinking I could simplify and consolidate some code by creating a UserControl. To test my theory, I picked a very simple prospect. Basically, on almost every screen, I expose a control that lets an administrator choose which tenant they are working on. (Non admins are assigned a tenant and do not see this functionality.)
So I created a user control, sticking to the MVVM pattern, that has its own viewmodel. The viewmodel exposes the list of tenants and a SelectedTenant property to the UC. The visual aspect is, basically, just a listbox. The UC also exposes a dependency property called SelectedTenant that could be bound to a property in the parent control or window.
The missing link, as many others have queried about, is somehow connecting the dependency property exposed by the UC to the ViewModel, underneath, so that when a user selects a tenant, the viewmodel's SelectedTenant property gets set and then propagates up to the UC's DP which would then trigger the parent control to, perhaps, take some action through its binding to the UC DP.
I haven't seen anything that explains a "proper" way to approach this. Most posts suggest using the parent datacontext or, essentially, abandoning MVVM for the UC.
Looking at the code I had, it seemed, to me, that a very simple approach would be to include code in the DP getter and setter that would read or write the UC's viewmodel values. Then I saw a post saying that you should never do that, but there was no explanation as to why. So I am asking why this is not considered a valid approach.