Veejay
Veejay

Reputation: 89

how do i calculate relative time in Listbox elements

I am binding a Listbox with a List which contains Minutes(200), how do I display relative time, like:

Upvotes: 1

Views: 116

Answers (1)

Igor Ralic
Igor Ralic

Reputation: 15006

You need something called a relative time converter.

If you search online, you'll find plenty of different implementations. A good one is definitely a part of Callisto toolkit.

You can also check out similar questions on StackOverflow such as this one.

Using a converter is really straightforward.

<TextBlock x:Name="TxtDuration" Text="{Binding Duration, Converter={StaticResource RelativeTimeConverter}}"/>

In this case the RelativeTimeConverter is declared as a static resource somewhere in your app.

Upvotes: 2

Related Questions