void CloseBtn_TouchDown(object sender, TouchEventArgs e) { Button btn = e.Source as Button; Grid g = btn.Parent as Grid; ImagePreview imgControl = g.Parent as ImagePreview; rootGrid.Children.Remove(imgControl); margin -= 50; limit += 1; }
void image_TouchUp(object sender, TouchEventArgs e) { if (!AlreadySwiped && (limit >= 0)) { ImagePreview imgControl = new ImagePreview(); imgControl.UpdateSource((e.Source as Image).Source); imgControl.Margin = new Thickness(margin); imgControl.CloseBtn.TouchDown += CloseBtn_TouchDown; //imgControl.TouchDown += imgControl_TouchDown; rootGrid.Children.Add(imgControl); margin += 50; limit -= 1; } }