wpf - Do I always have to write a converter for date-formatting? -


I often use textboxes in my wpf-projects which are bound to datetime-propertys. I want to format the dates in German format dd.m.yyyy . Currently I do this with a written converter, which I can give the necessary date format.

For example:

  & lt; Text box name = "date" text = "{binding relative source} = {reliability mode = search installers, exterior type = {x} type prize: mibro}}, path = date, converter = {static resource debug controller}, converter piramat = DD. MM.Yyy}} "/>  

The only thing that converts is, ToString (string format string) - The method of calling time is to call.

Would it be smart to format a date with 'data binding', if there is no need to write C # -Code, maybe there is an existing class in Microsoft-Libs, which is a date- Such a date-conversion can be done for binding, but I have not found it yet.

If there is any advice then it would be great,

Greetings, Martin

is the stringformer in .NET 3.5 SP1.

  & lt; Text box name = "date" text = "{binding date, string format = '{} {0: MM / dd / yyyy}'}" />  

results: 02/02 / 2010

  & lt; Text box name = "date" text = "{binding date, string format = '{} {0: D}'}" /> Result: Tuesday, February 02, 2010 

But the results can also vary depending on system default date time format.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -