Skip to main content
.NET 8.0+

MdiShowViewStrategy.GetActiveInspector() Method

Returns the active Inspector Window.

Namespace: DevExpress.ExpressApp.Win

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

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

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