Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding to show double as int

Tags:

binding

wpf

I want to to show the duration in minutes on my control but I don't want it to show up as with decimal numbers (eg, 65 instead of 65.94503).

<TextBlock Text="{Binding Duration.TotalMinutes, StringFormat=\{0\} minutes}" />

How can I do it?

like image 780
Metro Avatar asked Jul 26 '12 16:07

Metro


1 Answers

If you want an integer to display, I think that all you need to do is set the StringFormat property as follows:

<TextBlock Text="{Binding Duration.TotalMinutes, StringFormat=N0}"/>
like image 164
Sean Cogan Avatar answered Oct 18 '22 12:10

Sean Cogan