Binding a XAML control visibility to a ViewModel variable in WPF

Some instructions on how to bind the visibility of a XAML button control to a boolean value in a ViewModel class. 1. Create a new WPF application 2. Add the View Model class Right click your project folder and select Add > New Item > Class. Name your class MainWindowViewModel.cs: In your ViewModel class include …

Continue reading ‘Binding a XAML control visibility to a ViewModel variable in WPF’ »

Using RelayCommand / ICommand to handle events in WPF and MVVM

A step-by-step guide to using the RelayCommand class (based on ICommand) as means of handling user-initiated events in WPF / MVVM / XAML. 1. Create a new WPF application 2. Add the View Model class Right click your project folder and select Add > New Item > Class. Name your class MainWindowViewModel.cs: The MainWindowViewModel class …

Continue reading ‘Using RelayCommand / ICommand to handle events in WPF and MVVM’ »