Example #1
0
        public void AddProperty(PropertyViewModel property)
        {
            if (property.Parent != this)
                throw new InvalidOperationException("Bad parent");
            workingProperties.Add(property);

            property.PropertyChanged += OnPropertyViewModelPropertyChanged;
        }
Example #2
0
        public async Task <IActionResult> EditProperty(PropertyViewModel model)
        {
            if (ModelState.IsValid)
            {
                var property = await _converterHelper.ToPropertyAsync(model, false);

                _dataContext.Properties.Update(property);
                await _dataContext.SaveChangesAsync();

                return(RedirectToAction(nameof(MyProperties)));
            }
            model.PropertyTypes = _combosHelper.GetComboPropertyTypes();
            return(View(model));
        }
Example #3
0
        public async Task <IActionResult> AddProperty(PropertyViewModel view, bool isNew)
        {
            if (ModelState.IsValid)
            {
                var property = await _converterHelper.ToPropertyAsync(view, true);

                _dataContext.Properties.Add(property);
                await _dataContext.SaveChangesAsync();

                return(RedirectToAction($"{nameof(Details)}/{view.OwnerId}"));
            }

            return(View(view));
        }
        public async Task <IActionResult> EditProperty(PropertyViewModel model)
        {
            if (ModelState.IsValid)
            {
                var property = await _converterHelper.ToPropertyAsync(model, false);

                _dataContext.Properties.Update(property);
                await _dataContext.SaveChangesAsync();

                return(RedirectToAction($"Details/{model.OwnerId}"));
            }

            return(View(model));
        }
Example #5
0
        public async Task <IActionResult> EditProperty(PropertyViewModel view)
        {
            if (ModelState.IsValid)
            {
                var property = await _converterHelper.ToPropertyAsync(view, false);

                _dataContext.Properties.Update(property);
                await _dataContext.SaveChangesAsync();

                return(RedirectToAction(nameof(MyProperties)));
            }

            return(View(view));
        }
Example #6
0
        public async Task <IActionResult> AddProperty(PropertyViewModel model)
        {
            if (ModelState.IsValid)
            {
                var property = await _converterHelper.ToPropertyAsync(model, true);

                _dataContext.Properties.Add(property);
                await _dataContext.SaveChangesAsync();

                return(RedirectToAction(nameof(MyProperties)));
            }

            return(View(model));
        }
Example #7
0
        public static string PropertyHelper(PropertyViewModel prop, bool editable, string areaName = "", bool objectLink = false)
        {
            if (prop.Type.IsCollection && !prop.IsManytoManyCollection)
            {
                if (prop.PureTypeOnContext)
                {
                    return(@"<a data-bind='attr: {href: " + prop.ListEditorUrlName() + @"}, text: " + prop.JsVariableForBinding() + @"().length + "" - Edit""' class='btn btn-default btn-sm'></a>");
                }

                return(@"<div class='form-control-static' style='font-family: monospace; white-space: nowrap' data-bind='text: " + prop.JsVariableForBinding() + @"().length + "" Items""' ></div>");
            }
            else
            {
                if (editable)
                {
                    if (prop.Type.IsEnum)
                    {
                        return($"@(Knockout.SelectFor<{prop.Parent.FullyQualifiedName}>(p => p.{prop.Name}))");
                    }
                    else if (prop.HasValidValues)
                    {
                        if (prop.IsManytoManyCollection)
                        {
                            if (!string.IsNullOrWhiteSpace(areaName))
                            {
                                return($"@(Knockout.SelectForManyToMany<{prop.Parent.FullyQualifiedName}>(p => p.{prop.Name}, areaName: \"{areaName.EscapeStringLiteralForCSharp()}\"))");
                            }
                            else
                            {
                                return($"@(Knockout.SelectForManyToMany<{prop.Parent.FullyQualifiedName}>(p => p.{prop.Name}))");
                            }
                            //return Knockout.SelectForManyToMany(prop);
                        }
                        else
                        {
                            return($"@(Knockout.SelectForObject<{prop.Parent.FullyQualifiedName}>(p => p.{prop.Name}))");
                            //return Knockout.SelectObject(prop);
                        }
                    }
                    else
                    {
                        return($"@(Knockout.InputFor<{prop.Parent.FullyQualifiedName}>(p => p.{prop.Name}))");
                    }
                }
                else
                {
                    return($"@(Knockout.DisplayFor<{prop.Parent.FullyQualifiedName}>(p => p.{prop.Name}, {objectLink.ToString().ToLower()}))");
                }
            }
        }
Example #8
0
        private PropertyViewModel MapViewModel(Models.Property property)
        {
            var vm = new PropertyViewModel
            {
                Id               = property.Id,
                StreetName       = property.StreetName,
                Description      = property.Description,
                NumberOfBedrooms = property.NumberOfBedrooms,
                PropertyType     = property.PropertyType,
                Offers           = property.Offers?.Where(o => o.OfferingUserId == CurrentUserId).ToList(),
                Viewings         = property.Viewings?.Where(v => v.BuyerId == CurrentUserId).ToList()
            };

            return(vm);
        }
        public async Task <ActionResult> DeleteConfirmed(long id)
        {
            var query = new Sql().Select("*").From(TABLE_NAME).Where <PropertyViewModel>(x => x.PropertyId == id, DatabaseContext.SqlSyntax);

            PropertyViewModel propertyModel = await Task.FromResult((PropertyViewModel)db.Fetch <PropertyViewModel>(query).FirstOrDefault());

            await Task.FromResult(db.Delete(propertyModel));

            TempData["RecordDeleted"] = true;


            return(RedirectToCurrentUmbracoPage());

            //return RedirectToAction("Index");
        }
Example #10
0
        public static HtmlString SelectEnum(PropertyViewModel propertyModel, string placeholder = "")
        {
            string result = string.Format(@"
                <select class=""form-control"" 
                    data-bind=""select2: {0}"" 
                    placeholder=""{1}"">",
                                          propertyModel.JsVariableForBinding, placeholder);

            foreach (var item in propertyModel.Type.EnumValues)
            {
                result += string.Format(@"<option value=""{0}"">{1}</option>", item.Key, item.Value.ToProperCase());
            }
            result += "</select>";
            return(new HtmlString(result));
        }
        private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (this.pvm != null)
            {
                this.pvm.CreateVariantRequested -= OnCreateVariantRequested;
            }

            this.pvm = e.NewValue as PropertyViewModel;
            if (this.pvm != null && this.pvm.RequestCreateVariantCommand.CanExecute(null))
            {
                this.pvm.CreateVariantRequested += OnCreateVariantRequested;
            }

            (UIElementAutomationPeer.FromElement(this) as PropertyPresenterAutomationPeer)?.Refresh();
        }
Example #12
0
        public async Task <IActionResult> AddProperty(PropertyViewModel model)
        {
            if (ModelState.IsValid)
            {
                var property = await _converterHelper.ToPropertyAsync(model, true);

                _dataContext.Properties.Add(property);
                await _dataContext.SaveChangesAsync();

                return(RedirectToAction($"Details/{model.OwnerId}"));
            }

            model.PropertyTypes = _combosHelper.GetComboPropertyTypes();
            return(View(model));
        }
        public IActionResult Upsert(int?id)
        {
            PropertyViewModel = new PropertyViewModel()
            {
                Property     = new Models.Property(),
                CategoryList = _unitOfWork.Category.GetCategoryListForDropDown(),
                RentalList   = _unitOfWork.Rental.GetRentalListForDropDown()
            };
            if (id != null)
            {
                PropertyViewModel.Property = _unitOfWork.Property.Get(id.GetValueOrDefault());
            }

            return(View(PropertyViewModel));
        }
        public async Task <IActionResult> EditProperty(PropertyViewModel model)
        {
            // si cumplio con todas las dataanotations
            if (ModelState.IsValid)
            {
                // creamos un metodo que se encargue de esa conversion
                // el 2do parametro es para saber si estoy creando o editando
                var property = await _converterHelper.ToPropertyAsync(model, false);

                _dataContext.Properties.Update(property);
                await _dataContext.SaveChangesAsync();

                return(RedirectToAction($"Details/{model.OwnerId}"));
            }
            return(View(model));
        }
        // GET: PropertySurface/Delete/5
        /// <summary>
        /// Retrieve a record from the database to delete.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <ActionResult> Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var query = new Sql().Select("*").From(TABLE_NAME).Where <PropertyViewModel>(x => x.PropertyId == id, DatabaseContext.SqlSyntax);

            PropertyViewModel propertyModel = await Task.FromResult((PropertyViewModel)db.Fetch <PropertyViewModel>(query).FirstOrDefault());

            if (propertyModel == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(StringConstants.PARTIAL_VIEW_PATH + PARTIAL_VIEW_DELETE, await Task.FromResult(propertyModel)));
        }
Example #16
0
        private IProperty CreateProperty(DiagnosticInfo diagnosticInfo, byte[] packet)
        {
            Contract.Requires(diagnosticInfo != null);
            Contract.Requires(diagnosticInfo.PropertyMetaData != null);

            var propertyHexDigits = new ArraySegment <byte>(
                packet, (int)diagnosticInfo.Offset, (int)diagnosticInfo.Length);
            var property = new PropertyViewModel(
                diagnosticInfo.PropertyMetaData.Property,
                (int)diagnosticInfo.Offset,
                (int)diagnosticInfo.Length,
                diagnosticInfo.Value,
                propertyHexDigits);

            return(property);
        }
        public ActionResult Create(PropertyViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var model = new Property();

                model.InjectFrom <UnflatLoopValueInjection>(viewModel);

                PropertyService.CreateProperty(model);

                return(RedirectToAction("Manager"));
            }


            return(View(viewModel));
        }
Example #18
0
        public IHttpActionResult PutProperty(int id, PropertyViewModel property)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != property.Id)
            {
                return(BadRequest());
            }

            db.UpdateProperty(property.MapTo <Property>());

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #19
0
        public async Task <IActionResult> AddProperty(PropertyViewModel model)
        {
            if (ModelState.IsValid)
            {
                //Mandamos true or false dependiendo si es nueva o no
                var property = await _converterHelper.ToPropertyAsync(model, true);

                _dataContext.Properties.Add(property);
                await _dataContext.SaveChangesAsync();

                //Dtalles del propietario
                return(RedirectToAction($"Details/{model.OwnerId}"));
            }

            return(View(model));
        }
 public ActionResult NewProperty()
 {
     using (UnitOfWorkManager.NewUnitOfWork())
     {
         ListAllCountiesViewModel listAllCountyViewModel = new ListAllCountiesViewModel()
         {
             ListAllCounty = _countyService.ListOfCounties().ToList()
         };
         PropertyViewModel viewModel = new PropertyViewModel()
         {
             _listAllCountyViewModel = listAllCountyViewModel,
             _countyViewModel        = new CountyViewModel(),
         };
         return(View(viewModel));
     }
 }
Example #21
0
        public async Task <IActionResult> AddProperty(PropertyViewModel model)
        {
            if (ModelState.IsValid)
            {
                Property property = await _converterHeper.ToPropertyAsync(model, true);

                _dataContext.Properties.Add(property);
                await _dataContext.SaveChangesAsync();

                return(RedirectToAction($"Details/{model.OwnerId}"));
            }

            //S el modelo no es valido llena nuevamente el combde tipos de propiedades
            model.PropertyTypes = _combosHelper.GetComboPropertyTypes();
            return(View(model));
        }
        public async Task <IActionResult> Properties()
        {
            var userId = userManager.GetUserId(HttpContext.User);
            var user   = db.People.Include(c => c.Posts).SingleOrDefault(c => c.Id == userId);
            var model  = new PropertyViewModel
            {
                PropertyViewModelId = user.Id,
                Name        = user.UserName,
                Email       = user.Email,
                ImagePath   = user.ImagePath,
                Description = user.Description,
                Roles       = await userManager.GetRolesAsync(user)
            };

            return(View(model));
        }
Example #23
0
        public static HtmlString SelectString(PropertyViewModel propertyModel, string endpointName = null, string placeholder = "")
        {
            string resultField = "";

            if (endpointName == null)
            {
                endpointName = $"List?fields={propertyModel.JsonName}";
                resultField  = $"resultField: '{propertyModel.JsonName}',";
            }

            return(new HtmlString($@"
                    <select class=""form-control"" placeholder=""{placeholder}""
                        data-bind=""select2AjaxText: {propertyModel.JsVariableForBinding()}, {resultField}url: coalesceConfig.baseApiUrl() + '/{propertyModel.Parent.ApiRouteControllerPart}/{endpointName}'"">
                        <option></option>
                    </select >"));
        }
Example #24
0
        public List <PropertyViewModel> PropertyListForLease()
        {
            List <PropertyList> property = _propertyRepository.PropertyListForLease();

            List <PropertyViewModel> propertyVM = new List <PropertyViewModel>();

            foreach (PropertyList p in property)
            {
                PropertyViewModel pVM = new PropertyViewModel();
                pVM.PropertyId  = p.PropertyId;
                pVM.FullAddress = p.FullAddress;
                propertyVM.Add(pVM);
            }

            return(propertyVM);
        }
Example #25
0
        public static HtmlString SelectEnum(PropertyViewModel propertyModel, string placeholder = "")
        {
            var sb = new StringBuilder();

            sb.AppendLine($@"
                <select class=""form-control"" 
                    data-bind=""select2: {propertyModel.JsVariableForBinding()}"" 
                    placeholder=""{placeholder}"">");

            foreach (KeyValuePair <int, string> item in propertyModel.Type.EnumValues)
            {
                sb.AppendLine($@"<option value=""{item.Key}"">{item.Value.ToProperCase()}</option>");
            }
            sb.AppendLine("</select>");
            return(new HtmlString(sb.ToString()));
        }
        public override PropertyViewModel Create(PropertyInfo propertyInfo, object model, string name, System.Type type)
        {
            object value = base.ValueFromModelPropertyConvention(propertyInfo, model, name);

            SelectListItem[] selectListItems = Enum.GetNames(propertyInfo.PropertyType).Select(
                s => new SelectListItem {
                Text = s, Value = s, Selected = s == value.ToString()
            }).ToArray();

            PropertyViewModel viewModel = base.Create(propertyInfo, model, name, type);

            viewModel.Value       = selectListItems;
            viewModel.PartialName = "Enum";

            return(viewModel);
        }
Example #27
0
        protected override void OnViewModelChanged(PropertyViewModel oldModel)
        {
            base.OnViewModelChanged(oldModel);

            if (oldModel is TypePropertyViewModel tvm)
            {
                tvm.TypeRequested -= OnTypeRequested;
            }

            if (ViewModel != null)
            {
                ViewModel.TypeRequested += OnTypeRequested;

                OnPropertyChanged(ViewModel, new PropertyChangedEventArgs(null));
            }
        }
Example #28
0
        public static HtmlString SelectForManyToMany(PropertyViewModel propertyModel, string placeholder = "", string prefix = "", string areaName = "", int pageSize = 25)
        {
            string result = string.Format(@"
                <select data-bind = ""select2AjaxMultiple: {0}{1}, itemViewModel: {6}ViewModels.{2}, 
                    idFieldName: '{3}', textFieldName: '{4}', url: '/api/{5}/customlist', pageSize: '{7}',""
                    class=""form-control"" multiple=""multiple"">
                </select>",
                                          prefix, propertyModel.ManyToManyCollectionName.ToCamelCase(), propertyModel.ManyToManyCollectionProperty.Object.ViewModelClassName,
                                          propertyModel.ManyToManyCollectionProperty.Object.PrimaryKey.Name,
                                          propertyModel.ManyToManyCollectionProperty.Object.ListTextProperty.Name, propertyModel.ManyToManyCollectionProperty.Object.Name,
                                          (string.IsNullOrWhiteSpace(areaName) ? "" : $"{areaName}."),
                                          pageSize
                                          );

            return(new HtmlString(result));
        }
Example #29
0
        public void FilteredOutOfChildren()
        {
            IObjectEditor editor = null;

            var prop = new Mock <IPropertyInfo> ();

            prop.SetupGet(p => p.Type).Returns(typeof(int));
            prop.SetupGet(p => p.Name).Returns("one");

            var prop2 = new Mock <IPropertyInfo> ();

            prop2.SetupGet(p => p.Type).Returns(typeof(int));
            prop2.SetupGet(p => p.Name).Returns("two");

            editor = new MockObjectEditor(prop.Object, prop2.Object);
            var pvm  = new PropertyViewModel <int> (TargetPlatform.Default, prop.Object, new[] { editor });
            var pvm2 = new PropertyViewModel <int> (TargetPlatform.Default, prop2.Object, new[] { editor });

            var vm = new PropertyGroupViewModel(TargetPlatform.Default, "category", new[] { pvm, pvm2 }, new [] { editor });

            Assume.That(vm.Properties, Contains.Item(pvm));
            Assume.That(vm.Properties, Contains.Item(pvm2));

            bool changed = false;

            vm.PropertyChanged += (sender, args) => {
                if (args.PropertyName == nameof(PropertyGroupViewModel.HasChildElements))
                {
                    changed = true;
                }
            };

            vm.FilterText = "1";

            Assert.That(changed, Is.True, "HasChildElements didn't change");
            Assert.That(vm.HasChildElements, Is.False);
            Assert.That(vm.Properties, Does.Not.Contain(pvm2));
            Assert.That(vm.Properties, Does.Not.Contain(pvm));

            changed       = false;
            vm.FilterText = null;

            Assert.That(changed, Is.True, "HasChildElements didn't change");
            Assert.That(vm.HasChildElements, Is.True);
            Assert.That(vm.Properties, Contains.Item(pvm2));
            Assert.That(vm.Properties, Contains.Item(pvm));
        }
Example #30
0
        public IEnumerable <IProperty> Create(PacketViewModel packet)
        {
            Contract.Requires <ArgumentNullException>(packet != null);

            Message message = null;
            SerializationContext serializationContext = null;

            try
            {
                message = this.messageSerializerService.Deserialize(packet.Packet, out serializationContext);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("bork: Deserialization fail!: " + ex.Message);
            }

            var list = new List <IProperty>();

            if (message != null)
            {
                var headerProperties = this.CreateHeaderProperties(message, packet.Packet);
                var bodyProperties   = this.CreateProperties(serializationContext, packet.Packet);

                var headerRoot = new PropertyViewModel(
                    this.messagePropertyInfos[0], 0, 16, message, new ArraySegment <byte>(packet.Packet, 0, 16));
                foreach (var property in headerProperties)
                {
                    headerRoot.AddProperty(property);
                }

                var bodyRoot = new PropertyViewModel(
                    this.messagePropertyInfos[1],
                    16,
                    packet.Packet.Length - 16,
                    message,
                    new ArraySegment <byte>(packet.Packet, 16, packet.Packet.Length - 16));
                foreach (var property in bodyProperties)
                {
                    bodyRoot.AddProperty(property);
                }

                list.Add(headerRoot);
                list.Add(bodyRoot);
            }

            return(list);
        }
        private void okButton_Click(object sender, RoutedEventArgs e)
        {
            PropertyViewModel propertyViewModel = DataContext as PropertyViewModel;

            if (propertyViewModel != null)
            {
                propertyViewModel.OkCommand.Execute(null);
                if (propertyViewModel.CanClose)
                {
                    Close();
                }
                else
                {
                    MessageBox.Show(this, "Please set a Type!", "No Type set", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
        public EditorContainerViewModel(PropertyViewModel propertyViewModel, Control editorControl)
        {
            // Setup initial conditions.
            PropertyViewModel = propertyViewModel;
            EditorControl = editorControl;
            
            // Wire up events.
            editorViewModel = editorControl.DataContext as EditorViewModelBase;
            if (editorViewModel == null) throw new ArgumentOutOfRangeException("editorControl", "The editor control does not have a view-model");
            editorViewModel.PropertyChanged += HandleEditorModelPropertyChanged;

            // Store the control reference in the appropriate property.
            if (editorViewModel.IsPopup)
            {
                PopupControl = editorControl;
                PopupIsOpen = true;
            }
            else
            {
                InlineControl = editorControl;
            }
        }
Example #33
0
        private async Task LoadAssembly(string assemblyFilename)
        {
            if (string.IsNullOrWhiteSpace(assemblyFilename))
                throw new ArgumentException("Invalid 'assemblyFilename' argument");

            Assembly assembly = null;

            try
            {
                assembly = await Task.Factory.StartNew(() =>
                    {
                        try
                        {
                            return Assembly.LoadFrom(assemblyFilename);
                        }
                        catch
                        {
                            return null;
                        }
                    });
            }
            catch
            {
                return;
            }

            if (assembly == null)
                return;

            IEnumerable<Type> configurationSections = null;

            try
            {
                configurationSections = assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(ConfigurationSection)));
            }
            catch
            {
                return;
            }

            foreach (var configSection in configurationSections)
            {
                var hasValidProperties = false;
                var sectionViewModel = new SectionViewModel(assembly, configSection);

                var properties = await Task.Factory.StartNew(arg => ((Type)arg).GetProperties(BindingFlags.Public | BindingFlags.Instance), configSection);

                foreach (var property in properties.OrderBy(p => p.Name))
                {
                    var attribute = property.GetCustomAttributes(typeof(ConfigurationPropertyAttribute), true)
                        .Cast<ConfigurationPropertyAttribute>()
                        .FirstOrDefault();

                    if (attribute != null)
                    {
                        var propertyViewModel = new PropertyViewModel(sectionViewModel, property, attribute);
                        sectionViewModel.AddProperty(propertyViewModel);

                        hasValidProperties = true;
                    }
                }

                if (hasValidProperties)
                    workingSections.Add(sectionViewModel);
            }
        }
        public virtual PropertyViewModel CreateViewModel(object instance, PropertyDescriptor descriptor)
        {
            PropertyViewModel propertyViewModel = null;

            // Optional by Nullable type
            var nullable = descriptor.PropertyType.IsGenericType &&
                           descriptor.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>);
            if (nullable)
                propertyViewModel = new OptionalPropertyViewModel(instance, descriptor, null, owner);

            // Optional by Attribute
            var oa = AttributeHelper.GetAttribute<OptionalAttribute>(descriptor);
            if (oa != null)
                propertyViewModel = new OptionalPropertyViewModel(instance, descriptor, oa.PropertyName, owner);

            // Wide
            var wa = AttributeHelper.GetAttribute<WidePropertyAttribute>(descriptor);
            if (wa != null)
                propertyViewModel = new WidePropertyViewModel(instance, descriptor, wa.ShowHeader, owner);

            // If bool properties should be shown as checkbox only (no header label), we create
            // a CheckBoxPropertyViewModel
            if (descriptor.PropertyType == typeof(bool) && owner != null && !owner.ShowBoolHeader)
                propertyViewModel = new CheckBoxPropertyViewModel(instance, descriptor, owner);

            // Properties with the Slidable attribute set
            var sa = AttributeHelper.GetAttribute<SlidableAttribute>(descriptor);
            if (sa != null)
                propertyViewModel = new SlidablePropertyViewModel(instance, descriptor, owner)
                                        {
                                            SliderMinimum = sa.Minimum,
                                            SliderMaximum = sa.Maximum,
                                            SliderLargeChange = sa.LargeChange,
                                            SliderSmallChange = sa.SmallChange
                                        };

            // FilePath
            var fpa = AttributeHelper.GetAttribute<FilePathAttribute>(descriptor);
            if (fpa != null)
                propertyViewModel = new FilePathPropertyViewModel(instance, descriptor, owner) { Filter = fpa.Filter, DefaultExtension = fpa.DefaultExtension };

            // DirectoryPath
            var dpa = AttributeHelper.GetAttribute<DirectoryPathAttribute>(descriptor);
            if (dpa != null)
                propertyViewModel = new DirectoryPathPropertyViewModel(instance, descriptor, owner);

            // Default text property
            if (propertyViewModel == null)
            {
                var tp = new PropertyViewModel(instance, descriptor, owner);

                propertyViewModel = tp;
            }

            var fsa = AttributeHelper.GetAttribute<FormatStringAttribute>(descriptor);
            if (fsa != null)
                propertyViewModel.FormatString = fsa.FormatString;

            var ha = AttributeHelper.GetAttribute<HeightAttribute>(descriptor);
            if (ha != null)
                propertyViewModel.Height = ha.Height;
            if (propertyViewModel.Height>0)
            {
                propertyViewModel.AcceptsReturn = true;
                propertyViewModel.TextWrapping = TextWrapping.Wrap;
            }

            var soa = AttributeHelper.GetAttribute<SortOrderAttribute>(descriptor);
            if (soa != null)
                propertyViewModel.SortOrder = soa.SortOrder;

            return propertyViewModel;
        }