Skip to main content
All docs
V24.2

Access the Settings of a Property Editor in a Detail View

  • 3 minutes to read

This lesson explains how to access editors in a Detail View and change their settings.

The instructions below show how to make the Birthday property editor display a scrollable date picker in its drop-down window.

Note

Before you proceed, take a moment to review the previous lessons:

Step-by-Step Instructions

  1. In the MySolution.Blazor.Server and MySolution.Win projects, add a View Controller to the Controllers folder. Name the new controller DateEditCalendarController. Specify the controller ancestor class ObjectViewController<ViewType, ObjectType>:

    using DevExpress.ExpressApp;
    using MySolution.Module.BusinessObjects;
    // ...
    namespace MySolution.Blazor.Server.Controllers {
        public class DateEditCalendarController : ObjectViewController<DetailView, Employee> {
        // ...
        }
    }
    

    The DateEditCalendarController inherits from the ObjectViewController<ViewType, ObjectType> base class. The parameters of the base class enable the Controller only for Detail Views that display and edit Employee objects.

  2. Override the OnActivated method. Use the DetailViewExtensions.CustomizeViewItemControl method to access the Birthday property editor settings:

    // ...
    using DevExpress.ExpressApp.Blazor.Editors;
    
    namespace MySolution.Blazor.Server.Controllers {
        public partial class DateEditCalendarController : ObjectViewController<DetailView, Employee> {
            protected override void OnActivated() {
                base.OnActivated();
                //Access the Birthday property editor settings
                View.CustomizeViewItemControl<DateTimePropertyEditor>(this, SetCalendarView, nameof(Employee.Birthday));
            }
    
            private void SetCalendarView(DateTimePropertyEditor propertyEditor) {
                //Set the date picker display mode to scroll picker
                propertyEditor.ComponentModel.PickerDisplayMode = DevExpress.Blazor.DatePickerDisplayMode.ScrollPicker;
            }
        }
    }
    
  3. Run the application and open the Employee Detail View. The Birthday editor shows a scrollable date picker in its drop-down window:

    ASP.NET Core Blazor
    Scrollable date picker in ASP.NET Core Blazor
    Windows Forms
    Scrollable date picker in Windows Forms

Next Lesson

Format a Property Value

See Also