public static FieldViewModel Convert(Field field) { var name = field.Name; var viewModel = new FieldViewModel(name); viewModel.Id = field.Id; viewModel.SelectedAngle.DataValue = field.Angle; viewModel.Description.DataValue = field.Description; viewModel.IsActive.DataValue = field.IsActive; viewModel.IsRequired.DataValue = field.IsRequired; viewModel.Mask.DataValue = field.Mask; viewModel.FixedValue.DataValue = field.FixedValue; viewModel.ValidChars.DataValue = field.ValidChars; viewModel.SelectedFieldType.DataValue = field.FieldType; return viewModel; }
private void SubscribeToChanges(FieldViewModel field) { field.PropertyChanged += FieldOnPropertyChanged; }
private void UnsubscribeFromChanges(FieldViewModel field) { field.PropertyChanged -= FieldOnPropertyChanged; }
private void AddField() { var newField = new FieldViewModel("Field"); Fields.Add(newField); SelectedField = newField; SubscribeToChanges(newField); }