简体   繁体   中英

Changing User Control When Another Button in a User Control is Clicked

This answer can be in either Prism and/or Caliburn.Micro. Changing user control in the main shell can be done with something like this:

Prism

_regionManager.RequestNavigate("ContentRegion", uri);

Caliburn.Micro

ActivateItem(new ViewModel());

But my question is, how can you change the user control that is shown in the shellview upon clicking a button inside another user control?

You can use the exact same line (for Prism, at least) in any command anywhere. In case your're wondering how to get the _regionManager - just have it injected as constructor dependency.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM