private void CreateFormItem(IToolboxItem toolboxItem) { IFormItem formItem = m_formItemFactory.GetFormItem(toolboxItem); FormItems.Add(formItem); SelectFormItem(formItem); }
private void SelectFormItem(IFormItem formItemToSelect) { if (formItemToSelect is null) { return; } foreach (IFormItem formItem in FormItems) { if (formItem == formItemToSelect) { formItemToSelect.IsSelected = !formItemToSelect.IsSelected; } else { formItem.IsSelected = false; } } OnPropertyChanged(nameof(SelectedFormItem)); m_messengerHub.Send(new FormSurfaceItemSelectionMessage(formItemToSelect)); }
public FormSurfaceItemSelectionMessage(IFormItem selectedFormItem) { SelectedFormItem = selectedFormItem; }
void IForm.AddFormItem(IFormItem formItem) { _formItems.Add(formItem); }
void IForm.RemoveFormItem(IFormItem formItem) { _formItems.Remove(formItem); }
/// <summary> /// Adds new form item (field or category) to the form definition. /// </summary> /// <param name="formItem">Form item to add</param> protected void InsertFormItem(IFormItem formItem) { // Set new item preffix string newItemPreffix = (formItem is FormFieldInfo) ? newFieldPreffix : newCategPreffix; ListItem newItem = lstAttributes.Items.FindByValue(newItemPreffix); int newItemIndex = lstAttributes.Items.IndexOf(newItem); if ((newItemIndex > 0) && (lstAttributes.Items[newItemIndex - 1] != null)) { // Add new item at the specified position fi.AddFormItem(formItem, newItemIndex); } else { if (formItem is FormFieldInfo) { // Add new field at the end of the collection fi.AddFormField((FormFieldInfo)formItem); } else if (formItem is FormCategoryInfo) { // Add new category at the end of the collection fi.AddFormCategory((FormCategoryInfo)formItem); } } }