Custom Window for dialogs #94
-
Great project, thank you. Are there any samples showing how to use a custom Window to host a dialog rather than the inbuilt I can see IDialogService allows passing name of the hosting window registered but I haven't been able to get this working using protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.Register<MainWindow>();
containerRegistry.Register<CustomMainWindow>(); // Not working CustomMainWindow.axaml?
containerRegistry.RegisterDialog<MessageBoxView, MessageBoxViewModel>();
containerRegistry.RegisterDialog<DialogView, DialogViewModel>();
} It would be useful to be able to style the parent window inline with the main application (eg ExtendClientAreaToDecorationsHint="True"). I can see there is a similar open issue relating to style Add dialog style Settings #84 but custom window would be more useful in certain situations |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You need to register a DialogWindow using the RegisterDialogWindow method like this: |
Beta Was this translation helpful? Give feedback.
-
Excellent, thank you. I was close but needed to add |
Beta Was this translation helpful? Give feedback.
You need to register a DialogWindow using the RegisterDialogWindow method like this:
containerRegistry.RegisterDialogWindow<CustomMainWindow>();
, or provide a name if you don't want to override the default dialog window.
Make sure your window implements IDialogWindow like this:
class CustomMainWindow : Window, IDialogWindow
Btw, take a look at this Style definition if you want to have a consistent look for your application's windows.