Skip to main content
.NET 6.0+

MdiShowViewStrategy.GetActiveInspector() Method

Returns the active Inspector Window.

Namespace: DevExpress.ExpressApp.Win

Assembly: DevExpress.ExpressApp.Win.v24.1.dll

NuGet Package: DevExpress.ExpressApp.Win

Declaration

public WinWindow GetActiveInspector()

Returns

Type Description
WinWindow

A WinWindow object representing the active Inspector Window.

Remarks

An XAF Windows Forms application provides two types of Windows - Explorer and Inspector.

  • Explorer Window - contains navigation items and can display several List and Detail Views in tabs (when the MDI is used).
  • Inspector Window - does not provide navigation items and displays a single View

The following example demonstrates how to use this method in a Window Controller to access a current Window and View in MDI mode:

File:
MySolution.Win/Controllers/CustomWindowController.cs in solutions without the WinForms-specific module project. MySolution.Module.Win/Controllers/MyController.cs(.vb) in solutions with the WinForms-specific module project.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Win;
using DevExpress.Persistent.Base;
// ...
public class CustomWindowController : WindowController {
    public CustomWindowController() {
        SimpleAction myAction = new SimpleAction(this, "MyAction", PredefinedCategory.View);
        myAction.Execute += MyAction_Execute;
    }
    private void MyAction_Execute(object sender, SimpleActionExecuteEventArgs e) {
        MdiShowViewStrategy strategy = Application.ShowViewStrategy as MdiShowViewStrategy;
        if (strategy != null) {
            WinWindow currentWindow = strategy.GetActiveInspector();
            if (currentWindow != null) {
                View _view = currentWindow.View;
                // custom logic
            }
        }
    }
}
See Also