Search code examples
wpftextboxtype-conversion

WPF textbox bound to datetime string format not working when using converters


<TextBox Text="{Binding CurrentGameDate,Mode=OneWay,    
Converter={StaticResource DateTimeConverter},     
StringFormat='{}{0:dd/MM/yyyy}'}" /> 

string format doesnt seem to work.

i want only the date.
i've tried stringformat=d


Solution

  • String Format for dates works on variables of type DateTime only. So, you should return a DateTime instead of string from the converter.