Cannot perform runtime binding on a null reference

I received an update to the program, but the problem persists. Is it possible to select the first line from the grid when loading the view? I tried this Datagrid programly select a line, but i doesnt work no more. Maybe FirstorDefault method? Or when generating datagrid to have it on default whit this function?