Show a ToolbarPluginWpfUserControl as a modal

Dear,

I’ve implemented a UserControl based on ToolbarPluginWpfUserControl. When I click somewhere outside of the ToolbarPluginWpfUserControl the UserControl is dismissed.

Is it possible to keep the ToolbarPluginWpfUserControl on top and have it closed by a user similar to the “Add to incident project” button/window?

Thanks,

Bart

Solved with the following code:

   public override ToolbarPluginWpfUserControl GenerateWpfUserControl()
   {
	   YourToolbarPluginWpfUserControl control = new YourToolbarPluginWpfUserControl(this);               
	   _dlg = new Window
	   {
		   Content = control,
		   SizeToContent = SizeToContent.WidthAndHeight,
		   Owner = Application.Current.MainWindow,
		   ResizeMode = ResizeMode.NoResize,
		   WindowStyle = WindowStyle.ToolWindow,
	   };
	   _dlg.Closing += (s, e) =>
	   {
		   control.Visibility = Visibility.Collapsed;
		   control.Close();                    
	   };
	   _dlg.ShowDialog();

	   return control;                         
   }
1 Like

That is amazing good news. The expert I consulted did not return yet so I am very happy to hear you solved it. Thanks for sharing.