Skip to main content
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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