Здесь я пытаюсь изменить формат даты всех ячеек в столбце «Дата создания». My Значение конвертируется правильно, но не отображается в моей DataGrid.
Где я здесь не так?
public static void refreshTicketData(DataTable dt1, DataGrid TicketDG)
{
using (Global.cmd = new SqlCommand("Select INDEX_Tickets, Status, DateCreated,DateClosed from Tickets WHERE Customer_ID ='" + Global.CustomerID + "'", Global.cs))
{
dt1 = new DataTable();
dt1.Load(Global.cmd.ExecuteReader());
int count = 0;
foreach (DataRow row in dt1.Rows)
{
string getCurrent = row["DateCreated"].ToString();
DateTime readDate = DateTime.Parse(getCurrent);
string finalDate = readDate.ToString("dd-MM-yyyy");
dt1.Rows[count]["DateCreated"]=finalDate;
count++;
}
TicketDG.ItemsSource = dt1.DefaultView;
}
}