示例#1
0
 /// <summary>
 /// Sets the value of this property.
 /// </summary>
 public virtual void SetValue(object value)
 {
     var context = new SimpleTypeDescriptorContext { Instance = this.Settings, ServiceProvider = GetServiceProvider() };
     this.Settings.Value = this.ValueConverter.Value.CanConvertTo(context, typeof(string)) ? this.ValueConverter.Value.ConvertToString(context, value) : string.Empty;
 }
示例#2
0
 /// <summary>
 /// Gets the value of the property.
 /// </summary>
 public virtual object GetValue()
 {
     var context = new SimpleTypeDescriptorContext { Instance = this.Settings, ServiceProvider = GetServiceProvider() };
     if (this.Settings.HasValue())
     {
         return this.ValueConverter.Value.CanConvertFrom(context, typeof(string))
                    ? this.ValueConverter.Value.ConvertFromString(context, this.Settings.Value)
                    : string.Empty;
     }
     else
     {
         return string.Empty;
     }
 }