Following your code, you completely wrecked the purpose of doing work on a background thread.
In the DoWork method, on a background thread, you told the UI thread (this.Dispatcher.Invoke) to execute the long running code, completely removing the point of the background thread.
The background thread should be Invoking a method to add the file to the datagrid.
I believe you're looking for something like this:
void _background_DoWork(object sender, DoWorkEventArgs e)
{
FileInfo[] files = new
DirectoryInfo(System.IO.Path.GetTempPath()).GetFiles();
foreach (FileInfo fi in files)
{
if (fi != null)
{
this.Dispatcher.BeginInvoke((Action)(() => dataGrid1.Items.Add(fi)));
}
}
}
}