Log In
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Collapse]eXpressApp Framework
 [Expand]Getting Started
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
    How to: Access Objects Selected in the Current View
    How to: Access the Master Object from a Nested List View
    How to: Create and Show a Detail View of the Selected Object in a Popup Window
    How to: Detect a Lookup List View in Code
    How to: Display a Detail View Directly in Edit Mode in ASP.NET and Mobile Applications
    How to: Display a List View as a Chart
    How to: Display Several Views Side-by-Side
    How to: Hide Collection Properties in an Edit Mode Detail View for an ASP.NET Application
    How to: Implement a Singleton Business Object and Show its Detail View
    How to: Implement a View Item
    How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET)
    How to: Show a Custom Data-Bound Control in an XAF View (WinForms)
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Scheduler and Notifications
  [Expand]Miscellaneous UI Customizations
  Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Detect a Lookup List View in Code

This topic demonstrates how to check whether or not the current View is a Lookup List View. This can be helpful if you want to perform a certain customization in lookups only. For instance, you may want to hide the New Action displayed below the Lookup List View.


In mobile applications, the Lookup List View is implemented as a control without a template, so the approach described in this topic is not supported by the Mobile platform.

Implement a View Controller that targets List Views only. Override the OnActivated Method. Check that the Frame.Context value is LookupControl or LookupWindow. If it is true, this means that the current List View is a Lookup List View.


The New Action is provided by the NewObjectViewController. You can access this Controller using the Frame.GetControllers method and then access the NewObjectViewController.NewObjectAction property.


  • Alternatively, you can detect a Lookup List View by its View.Id - by default, all Lookup List Views have identifiers with the "_LookupListView" suffix. However, you will also detect Views that were initially designed to be used as lookups, but may not actually be used as lookups. The approach described in this topic allows you to detect any List View used as a Lookup List View.
  • This topic describes how to hide the New Action in all lookups and detect whether or not a lookup Template is currently being used. If you want to hide this Action for a particular Lookup List View, find the corresponding View node in the Model Editor and set the IModelView.AllowNew property to false.

Now you can run a WinForms or ASP.NET application to ensure that the New Action is deactivated in all Lookup List Views.

Expanded See Also

How would you rate this topic?​​​​​​​