I am dynamically creating buttons and button clicks from a WCF service, basically a catalog of items and then clicking through to details page for each item.
Button firstButton = new Button(view.Context);
firstButton.Text = "button 1";
firstButton.Id = getItemId;
firstButton.Click += (sender, e) =>
var productFragment = new ProductDetailFragment_1();
productFragment.itemId = getItemId;
Now all works. The problem is that I loop through the above as many times as are items in the XML from the WCF, and all clicks end up going to the last loaded item.
Is there a way I can dynamically create the buttons/clicks and have them be unique per item?