title: update TextBox text format on LostFocus - WinRT
body: <p>I am developing an Windows Store app using C# and XAML and am working on a user input page. I use an <code>IValueConverter</code> that converts my bound data into currency formatted <code>string</code> instead of just showing a decimal.</p>
  
  <p>When the user navigates to the page, the converter works fine and the <code>TextBox</code> text shows up with a currency format. However, when the user changes the <code>TextBox.Text</code> value and then the <code>TextBox</code> loses focus, the converter does not change it into a nice currency format again, it just stays formatted as it was entered by the user.</p>
  
  <p>As far as I can tell, there is no <code>StringFormat</code> to use like in <code>WPF</code>, so how do I get the <code>TextBox</code> to display the currency format again after the user edits the value?</p>
  
  <p>My converter:</p>
  
  <pre><code>public object Convert(object value, Type targetType, object parameter, string language)
      {
          if (parameter == null)
              return ((decimal)value).ToString();
          return String.Format((string)parameter, (decimal)value);
      }
  
  public object ConvertBack(object value, Type targetType, object parameter, string language)
      {
          decimal decVal = 0M;
          decimal.TryParse((string)value, out decVal);
          return decVal;
      }
  </code></pre>
  
  <p>My XAML:</p>
  
  <pre><code>&lt;Grid x:Name="InputGrid"&gt;
      ...
      &lt;Border&gt;
          &lt;TextBox Text="{Binding MyValue, ConverterParameter='{}{0:c}', Converter={StaticResource DecimalValueConverter}, Mode=TwoWay}"
      &lt;/Border&gt;
      ....
  &lt;/Grid&gt;
  </code></pre>
  
  <p><code>InputGrid.DataContext = MyValueClassInstance</code> set in the code-behind</p>