title: TimeSpan string format in Windows Phone XAML
body: <p>I'm attempting to apply a XAML StringFormat to a <code>TimeSpan</code> property. </p>
  
  <p><strong>NOTE</strong> This question applies to <strong>Windows Phone</strong>.  </p>
  
  <p>For WPF, the correct syntax is:</p>
  
  <pre><code>Text="{Binding ElapsedTime,StringFormat={}{0:m\\:ss}}"
  </code></pre>
  
  <p>For Silverlight, it needs single-quotes:</p>
  
  <pre><code>Text="{Binding ElapsedTime,StringFormat='{}{0:m\\:ss}'}"
  </code></pre>
  
  <p>But for Windows Phone, no matter what I have tried, the output is always the full "00:00:00.0000000".  </p>
  
  <ul>
  <li><code>StringFormat='m\\:ss'</code></li>
  <li><code>StringFormat='{}{0:m\\:ss}'</code></li>
  <li><code>StringFormat='m\:ss'</code></li>
  <li><code>StringFormat=m\\:ss</code></li>
  </ul>
  
  <p>Have I somehow missed the correct permutation, or is this just not possible for some reason in Windows Phone?</p>
  
  <hr/>
  
  <p><strong>Update</strong> </p>
  
  <p>I used a workaround (answer below), but would still like an explanation of the weirdness, if anyone knows.  (I say "weirdness" because <code>StringFormat</code> works perfectly well with <code>DateTime</code> properties, just not with <code>TimeSpan</code> ones.) </p>
  
  <p><strong>Update #2</strong></p>
  
  <p><a href="https://stackoverflow.com/q/4563081/1001985">A very similar question from 2010</a>.  Maybe this is just an issue with older and/or "compact" versions of .Net.  Or would <a href="https://stackoverflow.com/a/8430409/1001985">this answer</a> (<code>StringFormat=\{0:h\\:mm\}</code>) work?</p>