I tell you I am trying to update my datagrid without the need to give any button. This datagrid is filled by making calls to a database. It had occurred to me to use threads for in the background to update the calls every so often as if it were a screen refresh time.
private void recargar()
{
while (true)
{
DataTable dt = new DataTable();
dt = getconnection();
dataGrid1.ItemsSource = dt.DefaultView;
Thread.Sleep(3000);
}
}
The problem is that this way or creating a new thread never ends and does not take out the table (the interface), it remains in constant execution. So my question is that how can I do from the main call to reload and make the thread without preventing the table from coming out and thus changing the values of the table from time to time.
already someone knows how I can do to fit the text to the size of the datagrid?