I suggest you use the IDialogSerivice and it's WinUIDialogService implementation to accomplish this task.
Since you are using scaffolding, you should go into your collection view
(YouEntityCollectionView.xaml
) and go into Behaviors
section:
<dxmvvm:Interaction.Behaviors>
<dxwui:WinUIMessageBoxService/>
<dxmvvm:EventToCommand Command="{Binding OnLoadedCommand}" />
<WindowedDocumentUIService YieldToParent="True"/>
</dxmvvm:Interaction.Behaviors>
Then add your service into this section:
<dxmvvm:Interaction.Behaviors>
<dxwui:WinUIMessageBoxService/>
<dxmvvm:EventToCommand Command="{Binding OnLoadedCommand}" />
<dxwui:WinUIDialogService />
</dxmvvm:Interaction.Behaviors>
After that you should replace the IDocumentManagerService
with IDialogService
within the CollectionViewModel
code. It may look as follows:
// Edit:
//DocumentManagerService.ShowExistingEntityDocument<TEntity, TPrimaryKey>(this, primaryKey);
this.GetService<IDialogService>().ShowDialog(MessageButton.OKCancel, null, typeof(TEntity).Name + "View", primaryKey, this);
// New:
//DocumentManagerService.ShowNewEntityDocument(this, newEntityInitializer);
this.GetService<IDialogService>().ShowDialog(MessageButton.OKCancel, null, typeof(TEntity).Name + "View", newEntityInitializer, this);