328 reputation
210
bio website
location Hong Kong
age 33
visits member for 2 years, 1 month
seen Sep 3 at 2:49

C#/WPF UI Developer for a Big Bank


Sep
24
awarded  Autobiographer
Nov
22
awarded  Yearling
Oct
7
awarded  Popular Question
Dec
7
comment Hierarchical View/ViewModel/Presenters in MVPVM
Its fairly easy in MVVM - put an property on the main ViewModel called 'DetailViewModel', with return type object - this property is the ViewModel of the View to be displayed. In the main View you put a ContentControl where the details panel goes, and bind its 'Content' to the 'DetailViewModel' property. The last step is to create a DataTemplate in your main View resources that maps a particular ViewModel to a View. e.g. <DataTemplate DataType="{x:Type ViewModels:ViewModelB"><Views:ViewB/></DataTemplate>. This tells WPF that to display an object of type 'ViewModelB' use the view 'ViewB'.
Dec
5
awarded  Editor
Dec
5
revised Hierarchical View/ViewModel/Presenters in MVPVM
added 94 characters in body
Dec
5
awarded  Commentator
Dec
5
comment Hierarchical View/ViewModel/Presenters in MVPVM
RE: the MVP links you posted, thanks, but I'm specifically interested in MVPVM (I'd have tagged it as such, but the tag doesnt exist, and MVP and MVVM are the two closest patterns).
Dec
5
comment Hierarchical View/ViewModel/Presenters in MVPVM
"If you are swapping the ViewModel, shouldnt you swap the presenter too?" - this was partly the point I was trying to make - you have two things to set every time you want to set a child view - which is imo inelegant and prone to errors (if you swap the views, but not the presenters, it will superficially work, and pass some basic testing, but cause all sorts of weird problems with more complex use).
Dec
5
awarded  Benefactor
Dec
5
comment Hierarchical View/ViewModel/Presenters in MVPVM
This is a question about WPF, not ASP.NET.
Dec
5
comment Hierarchical View/ViewModel/Presenters in MVPVM
My example probably wasnt all that clear I think - swapping B and C wasnt the best illustration of the type of thing I want to do. Another similar problem would be if I have a main view with a list of items that I can select, to the right of that list I have a details panel, but the actual view I display in there changes depending on the item I've selected from the list.
Dec
5
comment Hierarchical View/ViewModel/Presenters in MVPVM
Thanks Glen, Im awarding you the Bounty because it seems you are correct in that there unfortunately it seems there is really no way of doing what I want to do.
Dec
2
awarded  Student
Nov
30
comment Creating a Predicate Builder extension method
sorry typo in that query: contactList.Select(c => new { Contact = c, Values = propertyLookup(c) }) .Where(cv => cv.Values.Any(v => matchFunc(v, filter.Value))).Select(cv => cv.Contact);
Nov
30
comment Creating a Predicate Builder extension method
Im not very familiar with NHibernate, but It looks like its having difficulty dealing with the more complex where clause. You might try to modify the query to: contactList.Select(c => new { Contact = c, Values = propertyLookup(c) }) .Where(cv => cv.Values.Any(v => matchFunc(v, filter.Value) .Select(cv => cv.Contact);
Nov
28
comment Creating a Predicate Builder extension method
Re-reading the @MAfifi's answer, the method is similar - just implemented using lambda's with lookups instead of classes and switch statements. The key advantage of the lookup approach over switch is that adding new functions, or columns requires an easier code change - and its also more extensible (it doesnt all have to be defined in the one class).
Nov
28
answered Creating a Predicate Builder extension method
Nov
28
awarded  Promoter
Nov
26
answered What are the best practices and strategies for transferring an outsourced software development project in-house?