i am in the process of learning the programming paradigm used in WAF. one problem that i am not sure how to solve correctly is interacting with the treeview control.
i am using the approach outlined here:
this article uses a view model for the whole tree and separate view models for the tree items.
i am tying to translate this approach to WAF and i am not sure how to implement the view model for items because items do not have corresponding views and view model needs its view as a parameter. should i use the Model type for that?
yet another question about how to fetch the selected item from the tree view.
i see two ways to do that:
one is to have a property on the main view model that exposes the currently selected item, and set this property when an item gets selected (see the article, there the items view model has "selected" bit). to do that the items need to know the
main view model, so i need to pass it to every single item. or use some sort of messaging system. too complicated.
the other is to ask the view to return the selected item. so, in my view interface i will have a method that returns the view model for the selected item. i am not sure whether this violates the separation of concerns principle.