//Remove UC element void dsc_RemoveItem(object sender, EventArgs e) { DetailsSelectorSubelementControl scnd = (DetailsSelectorSubelementControl)sender; ReturnedResults.Remove(scnd.ReturnResult); stcScnd.Children.Remove(scnd); }
//adding new UC element private void btnAdd_Click(object sender, RoutedEventArgs e) { DetailsSelectorSubelementControl dsc = new DetailsSelectorSubelementControl(); stcScnd.Children.Add(dsc); //ReturnedResults.Add(MainReturnedResult); ReturnedResults.Add(dsc.ReturnResult); dsc.RemoveItem += new EventHandler(dsc_RemoveItem); }