There’s a private field _showingAsDialog
whenever a WPF Window is a modal dialog. You could get that value via reflection and incorporate it in an extension method:
public static bool IsModal(this Window window)
{
return (bool)typeof(Window).GetField("_showingAsDialog", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(window);
}
The value is set to true when the window is shown as modal (ShowDialog) and set to false once the window closes.