Data binding to SelectedItem in a WPF Treeview

I realise this has already had an answer accepted, but I put this together to solve the problem. It uses a similar idea to Delta’s solution, but without the need to subclass the TreeView: public class BindableSelectedItemBehavior : Behavior<TreeView> { #region SelectedItem Property public object SelectedItem { get { return (object)GetValue(SelectedItemProperty); } set { SetValue(SelectedItemProperty, … Read more

WPF MVVM navigate views

Firstly, you don’t need any of those toolkits/frameworks to implement MVVM. It can be as simple as this… let’s assume that we have a MainViewModel, and PersonViewModel and a CompanyViewModel, each with their own related view and each extending an abstract base class BaseViewModel. In BaseViewModel, we can add common properties and/or ICommand instances and … Read more

Good or bad practice for Dialogs in wpf with MVVM?

If you are talking about dialogue windows and not just about the pop-up message boxes, please consider my approach below. The key points are: I pass a reference to Module Controller into the constructor of each ViewModel (you can use injection). That Module Controller has public/internal methods for creating dialogue windows (just creating, without returning … Read more

MVVM: Tutorial from start to finish?

Your question really seems to be asking 2 questions: Where are some good tutorials on WPF, assuming I have no previous WPF experience? Where are some good tutorials on learning MVVM? Some of these resources may be duplicated in previous answers… Tutorials on WPF A Guided Tour of WPF by Josh Smith I wrote a … Read more

tech