>>846
それだとオーバーロードが別の
dataGrid.SetBinding(ItemsControl.ItemsSourceProperty, "dt");
でいけない
840と同じなら
var bind = new Binding("dt"){ElementName = "MyWindow"};
dataGrid.SetBinding(ItemsControl.ItemsSourceProperty, bind);
して呼び出してみるとか。外からなんでなんか間違えてるかも
でも目的が達成されたからいいかな

バインディング宣言の概要 - WPF .NET Framework | Microsoft Docs
https://docs.microsoft.com/ja-jp/dotnet/desktop/wpf/data/binding-declarations-overview?view=netframeworkdesktop-4.8