You would add Topmost="True" to your Window .xaml
<Window x:Class="Test.Dialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Test"
mc:Ignorable="d"
Title="Your Title here" Height="300" Width="300"
Topmost="True"
.......
ShowInTaskbar="False">
<Grid>
And then interact with it through IExternalEventHandler within either of yours IExternalDBApplication, IExternalApplication, IExternalCommand class.
Dialog.Show();
/*ShowDialog() vs Show() The first opens a window and does not return until
the newly opened window is closed. It is a modal operation, meaning it blocks
interaction with other windows in the application until it is closed. The
second method opens a window but immediately returns control to the caller.
The window opened is non-modal, so other windows remain usable, and the user
can interact with all windows concurrently.*/
handler = new PluginEvent();
ExEvent = ExternalEvent.Create(handler);
public class PluginEvent : IExternalEventHandler
{
public void Execute(UIApplication app)
{
// Get the current UIDocument
UIDocument uiDoc = app.ActiveUIDocument;
if (uiDoc != null)
{
// Get the selected element from the Dialog
}
}
public string GetName()
{
return "Plugin Event";
}
}
In the .cs behind your .xaml you would use ExEvent.Raise(); thus your WPF window will give back the reins to Revit to execute Revit specific actions.
My recent post included the visual studio solution where I do everything you asked for above.
And another example of using IExternalEvent