简体   繁体   中英

WPF Modern UI Master Detail Link Between Windows

I am very new to WPF and am struggling with the most basic of tasks. I really hope someone can point me in the right direction please. I am using WPF with Modern UI utilising the MVVM pattern.

I have a UserControl which is successfully displaying some data in a datagrid. All I want to do is, via a button click, navigate to a second page (Usercontrol) and show some details of the selected row for editing etc.

I have found several examples of master detail setups on the same page but none that answers my questions using different windows/pages/usercontrols.

This seems like it should be the most simple of tasks but for some reason I am really struggling. I hope I am just missing something obvious as I am feeling pretty stupid about now.

Thanks in advance.

To use different controls together, you need to make the view models communicate. This can be done by passing references, or more commonly via a messaging framework.

I prefer MVVM Light from NuGet. It allows each view model to send and register to messages of specific types.

It's kind of like broadcasting events but allows your parent view model to send messages to the child view model without actually knowing about it.

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