I'd like to create a custom hyperlink control that, when clicked, navigates to a region and parameters specified by bindings to properties in a parent ViewModel. Since I'd like to be able to drop this control into any arbitrary xaml, it cannot have its own ViewModel or Module Manager, which is usually how a Region Manager is obtained.
Is there a way to get a RegionManager
object in code-behind, without having to inject it into a ViewModel? I see that there's a static GetRegionManager()
method on the RegionManager
class, but it takes a dependency property parameter that I don't understand how to use.
Why I'd like to do this in code-behind:
While I could certainly supply the constructor that allows injection of the RegionManager
object into the ViewModel, I would like my new Hyperlink control to be more self-contained and independent than that. Involving the ViewModel in this manner means that the navigation is going to take place in the ViewModel, not the new Hyperlink control, which sort of defeats the purpose of having a self-contained Hyperlink control.