title: wpf, c# set Margin.Left of FrameWorkElement using Reflection
body: <p>Does anyone know how to set a second-level property using reflection?
  In case I want to set the width of lets say a StackPanel, that works fine:</p>
  
  <pre><code>PropertyInfo pi = stp.GetType().GetProperty("Width", BindingFlags.Public | BindingFlags.Instance);
  if (null != pi)
  {
    pi.SetValue(stp, Convert.ChangeType("100", pi.PropertyType), null);
  }
  </code></pre>
  
  <p>But if I want to set Margin.Left:</p>
  
  <pre><code>PropertyInfo pi = stp.GetType().GetProperty("Margin.Left", BindingFlags.Public | BindingFlags.Instance);
  if (null != pi)
  {
    pi.SetValue(stp, Convert.ChangeType("100", pi.PropertyType), null);
  }
  </code></pre>
  
  <p>It doesn't work at all. pi is null. I can't get a valid PropertyInfo.
  Trying to get a valid FieldInfo fails also:</p>
  
  <pre><code>FieldInfo prop = stp.GetType().GetField("Margin.Left", BindingFlags.Public | BindingFlags.Instance);
  if (null != prop)
  {
    prop.SetValue(stp, Convert.ChangeType("20", prop.FieldType));
  }
  </code></pre>