DelegateCommand<string> with "object sender"

Topics: Prism v2 - WPF 3.5
Jul 9, 2009 at 8:33 AM

I have a command to look up a stock item.  The list of stock items is in a grid and the command is on the presentation model in the datacontext.  The user taps in some text, hits F5 and the command takes the text and looks up the stock item.  Problem is that I don't know which line of the grid it came from so I can't set the found stock item back onto the row.

How can I tie the grid row to the command?


Thanks in advance




Jul 9, 2009 at 11:06 AM

You should have a CurrentStockItem property in the PresentationModel, bound to the DataGrid's SelectedItem, and this way you can access the current stock item during command execution.




Jul 9, 2009 at 11:25 AM

Fine idea, thanks for the suggestion.  Works ok.