예제 #1
0
 public override object ConvertTo(ITypeDescriptorContext typeDescriptorContext, CultureInfo cultureInfo, object value, Type destinationType)
 {
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     if (value != null && value is GridLength)
     {
         GridLength gl = (GridLength)value;
         if (destinationType == typeof(string))
         {
             return(GridLengthConverter.ToString(gl, cultureInfo));
         }
         if (destinationType == typeof(InstanceDescriptor))
         {
             ConstructorInfo constructor = typeof(GridLength).GetConstructor(new Type[]
             {
                 typeof(double),
                 typeof(GridUnitType)
             });
             return(new InstanceDescriptor(constructor, new object[]
             {
                 gl.Value,
                 gl.GridUnitType
             }));
         }
     }
     throw base.GetConvertToException(value, destinationType);
 }
예제 #2
0
 /// <summary>Returns a <see cref="T:System.String" /> representation of the <see cref="T:System.Windows.GridLength" />.</summary>
 /// <returns>A <see cref="T:System.String" /> representation of the current <see cref="T:System.Windows.GridLength" /> structure.</returns>
 // Token: 0x06000723 RID: 1827 RVA: 0x000169BB File Offset: 0x00014BBB
 public override string ToString()
 {
     return(GridLengthConverter.ToString(this, CultureInfo.InvariantCulture));
 }