0

I have a gridView. instead of ItemTemplate I used user control for gridviewitems because I cant manage to trigger the button click event in the itemtemplate

here is my code

for (int i = 0; i < collection.Count(); i++)
{
     GridViewItem gridViewItem = new GridViewItem();
     gridViewItem.Tag = i;
     PhotoItem item = new PhotoItem();

     item.photoTitleTextBlock.Text = collection[i].Type.ToString();
     item.eraseButton.Click += (sender, args) => { itemSent(item); };

     gridViewItem.Content = item;
     gvIdTypes.Items.Add(gridViewItem);
}

in my userControl PhotoItem there are textblock, button and image textblock.text comes from collection if gridview item is selected(via gridView.selectionChanged event) web cam takes photo and puts on the image of the UserControl

how can I figure out which of the item is selected in the selectionChanged event

1
  • How about getting the value of the SelectedItem property of the GridView?
    – Clemens
    Jul 25, 2013 at 8:12

1 Answer 1

0

Use ItemClick instead and then you can access the ClickedItem in ItemClickEventArgs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.