title: How to draw squares and assign the color property dynamically (PDFsharp)?
body: <p>I am using PDFsharp to export a chart legend. I am using a for loop and a table to display the properties. There is actually only one property: the Subdivision name. The object has the right RGB color to use. How can I draw squares next to it just as chart legends display the series? Forgive me for the variable names, I am going off a example. </p>
  
  <pre><code>//Writting Table Header Text
  textformater.DrawString(" Color", tableheader, XBrushes.Black, snoColumn);
  textformater.DrawString(" Subdivision Name", tableheader, XBrushes.Black, snoStudentName);
  
  foreach (var item in data)
  {
      y = y + 30;
      XRect snoColumnVal = new XRect(35, y, 70, height);
      XRect snoStudentNameVal = new XRect(100, y, 250, height);
      textformater.DrawString(item.Color, tableheader, XBrushes.Black, snoColumnVal);
      textformater.DrawString(item.Name, tableheader, XBrushes.Black, snoStudentNameVal);
  
  }
  </code></pre>
  
  <p>Here is the output:</p>
  
  <p><img src="https://i.stack.imgur.com/eAzqt.jpg" alt="pdf"></p>
  
  <p>this is what I need it to look like
  <img src="https://i.stack.imgur.com/AljOg.jpg" alt="pic"></p>