Invoke Power Shell: Failed to find DataGrid or SubmitButton in the XAML

I have a PowerShell script that works fine in PowerShell for reading Excel data and displaying it in a WPF form with a DataGrid and Submit button. However, when invoking this script in UiPath, I get the error: “Invoke Power Shell: Failed to find DataGrid or Submit Button in the XAML”. Can someone please tell me how can I resolve this issue so that UiPath can properly interact with the DataGrid and Submit Button? I am attaching the PS Script and .xaml file here also.
Main.xaml (10.4 KB)
Power Shell Code.txt (4.2 KB)