public PropertyControlInfoAttribute(Type propertyType, PropertyControlType controlType) { if (!typeof(Property).IsAssignableFrom(propertyType)) { throw new ArgumentException("propertyType must be a type that derives from Property"); } this.propertyType = propertyType; this.controlType = controlType; }
private PropertyControlInfo(Property property) : base() { this.property = property; PropertyControlType defaultControlType = propertyTypeToDefaultControlType[this.property.GetType()]; this.controlType = StaticListChoiceProperty.CreateForEnum <PropertyControlType>(ControlInfoPropertyNames.ControlType, defaultControlType, false); this.controlType.ValueChanged += new EventHandler(ControlType_ValueChanged); this.ControlProperties = controlTypeToProperties[PairUtils.Create(property.GetType(), (PropertyControlType)this.controlType.Value)].Clone(); }
public PropertyControlInfoAttribute(Type propertyType, PropertyControlType controlType) { if (!typeof(Property).IsAssignableFrom(propertyType)) { throw new ArgumentException("propertyType must be a type that derives from Property"); } this.PropertyType = propertyType; this.ControlType = controlType; }
public void LoadProperty(int id) { switch (_editType) { case AddEditPropertyType.Track: _tProperty = DAL.AdHocData.TrackProperties.FirstOrDefault(x => x.Id == id); if (_tProperty != null) { _property = _tProperty.Property; } break; case AddEditPropertyType.SearchCriteria: _sProperty = DAL.AdHocData.SearchCritrias.FirstOrDefault(x => x.Id == id); if (_sProperty != null) { _property = _sProperty.Property; } break; } if (_property == null) { return; } PropertyName = _property.Name; switch (_property.PropertyType.Name) { case "Select One": ControlType = PropertyControlType.SelectOne; Options = DAL.AdHocData.PropertyOptions.Where(x => x.PropertyId == _property.Id).ToList(); SelectedOption = Options.FirstOrDefault(x => x.Value == _value); break; case "Text Value": ControlType = PropertyControlType.Text; TextValue = _value; break; case "Yes / No": ControlType = PropertyControlType.Bool; _boolValue = _value == "1"; NotifyOfPropertyChange(() => BoolValue); break; case "Select Multiple": ControlType = PropertyControlType.SelectMultiple; List = DAL.AdHocData.PropertyOptions.Where(x => x.PropertyId == _property.Id).ToList(); break; } }
public bool SetPropertyControlType(object propertyName, PropertyControlType newControlType) { PropertyControlInfo pci = FindControlForPropertyName(propertyName); if (pci == null) { return(false); } if (-1 == Array.IndexOf(pci.ControlType.ValueChoices, newControlType)) { return(false); } pci.ControlType.Value = newControlType; return(true); }
public void ClearControl() { ControlType = PropertyControlType.NoneSelected; PropertyName = "No property selected"; }