views:

84

answers:

1

Assuming that you have two windows where one window has a listbox and the other window should have the detail information for an item currently selected in the listbox. In one window this is easy enough to do but how would one do this with two windows? Unfortunately, two windows is the only option here.

+3  A: 

assuming they are both part of the same application, then there has to be some type of parent container.

Either the window with the listbox is the parent to the details window, or there is a window which owns them both.

Regardless, it's just a matter of passing the object from one window to the other.

for example, your object is called foo, and has the following parameters: fooA, fooB, fooC, fooD.

The listbox's datacontext is thus a observablecollection(of foo). when a user double-clicks on one of the list box items, the listbox's selectedItem is one of the foo object. taking that, you provide it to your details window either by direct pass [myWindow.LoadFooForEditing(myFoo)] or by raising a event to the listbox window's owner and letting it pass the data.

If they are two separate applications then you need to start considering things such as remoting or MSMQ as tools to pass information between two applications.

Stephen Wrighton
Works perfectly for me. Thanks Stephen.
TravisPUK