I have a String “0214” i would like te present this as 02:14 is this possible in wpf with stringFormat and binding.
If it would be an integer i could do it like bellow but the problem is that the “0” disapears and becomes Int “214” But this is not good for placing in the database because it requires 4 numbers.
<GridViewColumn Header="Start" DisplayMemberBinding="{Binding Start, StringFormat={}{0:00\:00}}"/>
output: ’02:14′
StringFormatis not actually used to format strings. It’s used to format non-string values into strings.You can use an IValueConverter however to convert your string into the format you want. Another option would be to alter your data class to expose a read-only
FormattedStartproperty which returns the formatted value.