title: How to implement a TypeConverter for a type and property I don't own?
body: <p>This is annoying:</p>
  
  <pre><code>&lt;GeometryDrawing&gt;
      &lt;GeometryDrawing.Pen&gt;
          &lt;Pen Brush="Black"/&gt;
      &lt;/GeometryDrawing.Pen&gt;
  &lt;/GeometryDrawing&gt;
  </code></pre>
  
  <p>I want this:</p>
  
  <pre><code>&lt;GeometryDrawing Pen="Black"/&gt;
  </code></pre>
  
  <p>So I write a <code>TypeConverter</code>:</p>
  
  <pre><code>public class PenConverter : TypeConverter
  {
      static readonly BrushConverter brushConverter = new BrushConverter();
  
      public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
      {
          if (sourceType == typeof(string)) return true;
          return base.CanConvertFrom(context, sourceType);
      }
  
      public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
      {
          var s = value as string;
          if (a != null)
          {
              var brush = brushConverter.ConvertFromInvariantString(s) as Brush;
              return new Pen(brush, 1);
          }
          return base.ConvertFrom(context, culture, value);
      }
  }
  </code></pre>
  
  <p>Now, how do I link it up with the <code>Pen</code> type? I can't just add a <code>TypeConverterAttribute</code> to it as I don't own it (nor do I own <code>GeometryDrawing.Pen</code> property).</p>