Hi there,
I'm hoping to open a ProWindow on a RowCreatedEvent/RowModifiedEvent, but I'm getting an error saying "the calling thread cannot access this object because a different thread owns it".
Essentially, I'm trying to take user input to force update several attributes on the row being created.
I've tried wrapping everything in the Current.Dispatcher.Invoke() but then my OK relay command is disabled (I assume because the thread is locked).
My code is as follows:
public static void OnRowCreated(RowChangedEventArgs args)
{
CreateLotWindow createLotWindow = new CreateLotWindow();
createLotWindow.Owner = FrameworkApplication.Current.MainWindow; //errors out here
var vm = createLotWindow.DataContext as CreateLotWindowViewModel;
if (createLotWindow.ShowDialog() == true)
{
string lotNo = vm.LotCount;
QueuedTask.Run(()=> {
// do stuff with user input
}
}
}
Any help is greatly appreciated!