Note that there are some explanatory texts on larger screens.

plurals
  1. PODataGrid displaying the wrong dateformat
    text
    copied!<p>I'm displaying some information about case which already exist in a <code>DataGrid</code>.</p> <p>In my <code>MS Access</code> database all the date are stored in a <code>DateTime</code> format and looks like this : dd/MM/yyyy.</p> <p>The problem is that when displayed on the <code>DataGrid</code> when the program runs, the format change to MM/dd/yyyy. </p> <p>The thing that makes me lost is that when I display in a <code>MessageBox</code> the content of the concerned cells just before assign the <code>DataTable</code> to the <code>DataGrid</code> I've got the right format (dd/MM/yyyy).</p> <p>I've tried to change the <code>DateTimeMode</code> but the same format is displayed.</p> <p>Someone got any tips who to fix this problem ? I give you the code below :</p> <p>DataTable temp = dt.Clone();</p> <pre><code> temp = (from nardin in dt.AsEnumerable().Distinct() where nardin["NUMERO CLIENT"].ToString() == _centerID.ToString() select nardin).CopyToDataTable(); RemoveDuplicates(temp, "NUMERO DOSSIER"); foreach (DataRow row in temp.Rows) { MessageBox.Show(row["DATE INTERVENTION"].ToString()); //this gives me the DateTime format i'd like to display } existingCase.ItemsSource = temp.AsDataView(); //once assigned to the DataGrid the DateTime format is not the same as above </code></pre> <p>Actually the DataGrid is declared like this in the xaml file : </p> <pre><code> &lt;DataGrid SelectionUnit="FullRow" SelectedItem="{Binding SelectedBI, Mode=TwoWay}" AutoGenerateColumns="True" Margin="0,167,12,167" Name="existingBI" Width="588" HorizontalAlignment="Right"&gt; &lt;DataGrid.RowStyle&gt; &lt;Style TargetType="{x:Type DataGridRow}"&gt; &lt;EventSetter Event="MouseDoubleClick" Handler="resultDataGridBI_MouseDoubleClick"/&gt; &lt;/Style&gt; &lt;/DataGrid.RowStyle&gt; &lt;/DataGrid&gt; </code></pre> <p>I'm binding the DataTable with: <code>existingCase.ItemsSource = temp.AsDataView();</code></p> <p>In advance, thanks !</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload