public MetadataDefinitionViewModel() : this(null) { add = new RelayCommand((o) => { if (FieldName != null && FieldName.Trim() != string.Empty) { return(true); } return(false); }, (o) => { DataObjectMetadata meta = FromCurrentToMetadata(); DataObjectMetadataViewModel metaVm = new DataObjectMetadataViewModel(meta); MetadataCollection.Add(metaVm); }); remove = new RelayCommand((o) => { if (o == null) { return(false); } int i = (int)o; return((i >= 0) && (i < MetadataCollection.Count)); }, (o) => { int i = (int)o; MetadataCollection.RemoveAt(i); }); }