I have two WPF forms ( MainWindow
and ChildWindow
) with their different viewModels already in place ( MainViewModel
and ChildViewModel
) to manage the events.
When I click the menu item on MainWindow
to open the ChildWindow
, I want a specific button to be hidden in the ChildWindow
.
How can I perform this using MVVM?
On the child window's VM
Visibility
property bind to the VM property and use a Boolean to visibility converter (has one already been defined in the page's resource, of so use it) to take the true/false value and change it to a visibility value.This article doesn't get into the full blown history of MVVM, but it provides a basic example to help you with MVVM and binding:
Xaml: ViewModel Main Page Instantiation and Loading Strategy for Easier Binding
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.