Clickable list of items to load another View - best approach?

Topics: Actions & Coroutines, Conventions, UI Architecture
Sep 28, 2011 at 4:21 PM

Disclaimer: I'm new to Silverlight and C.M.

We have the following scenario which I feel is so incredibly straightforward that I'm surprised I'm even having to write this question:

An AppointmentsView / AppointsmentsViewModel which contains a list of a Appointments, which are of type AppointmentViewModel and have a corresponding AppointmentView.

When one of the Appointments in the list is clicked, a new AppointmentDetailsViewModel should be loaded (along with its associated View).

Loading the AppointmentDetailsViewModel isn't a problem, but where I'm struggling is understanding:

(a) The best Silverlight control to use for a 'menu' style list such as this
(b) The event of that control to handle in order to capture the click
(c) Where to put the logic to hookup the click to the handler within our ViewModel hierarchy.

To my mind, the hookup should be on the AppointmentsListView so that the AppointmentViewModel/View can be independent of any events/handlers.  However, I'm unsure as to how to configure click event handlers for eg: ListBoxItems when there is no template defined in the View that contains the ListBox.

Any pointers would be greatly appreciated - it seems like such a simple concept!