title: How to format text in a ListBox where items are added dynamically?
body: <p>I need to format the text in each textblock, which is an item of my ListBox. I have managed to make something but it doesnt look the same as if I would call the Console.WriteLine-Method.</p>
  
  <pre><code>private void addNewGameItem(string gamename, string lastChangedDate)
      {
          ListBoxItem lbi = new ListBoxItem();
          StackPanel stpl = new StackPanel();
          TextBlock tbl = new TextBlock();
  
          tbl.Text = String.Format("{0,-100} {1,30}", gamename, lastChangedDate);
          tbl.FontSize = textBlockFontsize;
  
          stpl.Orientation = Orientation.Horizontal;
          stpl.Children.Add(tbl);
          lbi.Content = stpl;
          savedGamesList.Items.Add(lbi);//Add the ListBoxItem to the ListBox
      }
  </code></pre>
  
  <p>The problem is that if the gamename is longer than for example the previous one, the date will appear futher right. How can I format this, that it doesnt matter how long the gamename is, so the date-string will start on the same position, in each textblock? </p>