Simon Mourier's Avatar
Simon Mourier's blog (1807 answers on StackOverflow) about Microsoft technologies C#, C/C++, .NET, WinRT, WinUI3, AOT, P/Invoke, COM, Interop, DirectX, Direct2D, Windows, ...
  • 🔎︎ Search
  • Categories
  • Archives
  • About Me
  • winui

How can I format a textbox number to curreny with 2 decimal places?

May 18, 2023 See the question and my original answer on StackOverflow

You can use function binding, like this:

<Window xmlns:sys="using:System" ...>
...
    <TextBlock Text="{x:Bind sys:String.Format('{0:C2}', ViewModel.Premium)}" />
...
</Window>

PS: can't be TwoWay in the case since it's now a computed value

  • SmoBlog © 2010-2026 Simon Mourier. All rights reserved.
  • Privacy & Terms