Create a new detail view or re-use the existing?

Mar 1, 2012 at 1:21 PM


I have a question about the Csla/Bxf MVVM sample code.
There is a view with a list of items, and another view displaying the details of an item.
Whenever a new item is klicked from the list, a new detail view and viewModel is instanced displaying the new data.

Is this "the way to do" for such a scenario?
In my opinion, an existing view could just be switched to a new model data instead to be replaced completely?



Mar 5, 2012 at 4:10 PM

The normal way to handle this is to allow data binding to do the work.

Data binding maintains something called 'currency'. This just means that one object in a list is "current" at any time.

When you bind a list control (like ListBox) to a list it displays all items. When you bind detail controls (like a TextBox) to a list, it shows only the item that has currency - the current item.

When the user clicks an item in a list, that changes the currency.

The result is that the detail part of your form can bind to the list too - and the controls will automatically be bound to the current item from the list.

Mar 5, 2012 at 5:30 PM

But how to do this when the list displays a collection of simple ReadOnlyBusinessBase Objects with very few fields,
and the detail view should display (and allow edit) on a full featured BusinessBase Object of the same data entity?