private UserControls.ListControls.Item AddNewListItem(object item, System.Collections.IList list, UserControls.ListControls.GroupCard rootFieldGroupCard, string fieldName) { var listControlItem = new UserControls.ListControls.Item(); var ProcessedClass = ProcessClass(item); ProcessedClass.ForEach(control => { listControlItem.ControlWrapPanel.Children.Add(control); }); listControlItem.DeleteItemIcon.MouseLeftButtonUp += (s, e) => { var deleteItemMessageBox = new Windows.AFG_MessageBox("Remove Item?", "Are you sure you want to remove this?"); deleteItemMessageBox.ShowDialog(); if (deleteItemMessageBox.MessageBoxResult == MessageBoxResult.Yes) { rootFieldGroupCard.ControlsWrapPanel.Children.Remove(listControlItem); list.Remove(item); OnPropertyModified?.Invoke(fieldName, null); } }; return(listControlItem); }
private UserControls.ListControls.Item AddNewItemListItem(FormControlSettings controlSettings, UserControls.ListControls.GroupCard rootFieldGroupCard, System.Collections.IList list, string fieldName) { var userControl = HandleUserControl(controlSettings); if (userControl != null) { var listControlItem = new UserControls.ListControls.Item(); listControlItem.ControlWrapPanel.Children.Add(userControl); listControlItem.DeleteItemIcon.MouseLeftButtonUp += (s, e) => { var deleteItemMessageBox = new Windows.AFG_MessageBox("Remove Item?", "Are you sure you want to remove this?"); deleteItemMessageBox.ShowDialog(); if (deleteItemMessageBox.MessageBoxResult == MessageBoxResult.Yes) { rootFieldGroupCard.ControlsWrapPanel.Children.Remove(listControlItem); list.Remove(controlSettings.Value); OnPropertyModified?.Invoke(fieldName, null); } }; return(listControlItem); } return(null); }