WPF GridView: Changing the DateTime formatting for bound DataTable -


We have a WPF GridView dynamically from a DataTable (which is a direct result of a DB query in turn naturally ). It basically works fine and displays whatever DB query results are in a good table.

The problem now is that some datetime column of results, and the date display US format and is not always user-defined date format.

Is there an easy way to set formatting for datetime GridView display?

We do not know in advance that the column will be the date time. Separately a number of tables are displayed

The way we have thus filling gridview:

  MyListView.DataContext = data; MyListView.SetBinding (ListView.ItemsSourceProperty, New Compulsive ()); MyGridView.Columns.Clear (); Forex (DataColumn data calls. Column) {GridViewColumn gvcol = new GridViewColumn (); Gvcol.Header = col.ColumnName; Gvcol.DisplayMemberBinding = New binding (col.ColumnName); MyGridView.Columns.Add (gvcol); }  

It should be enough to put the current culture applucation startup

/// & lt; Summary & gt; Interaction logic for /// App.xaml /// & lt; / Summary & gt; Public partial class App: Application {public Application () {FrameworkElement.LanguageProperty.OverrideMetadata (typeof (FrameworkElement), New FrameworkPropertyMetadata (XmlLanguage.GetLanguage (CultureInfo.CurrentCulture.IetfLanguageTag))); }}

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -