Skip to main content
A newer version of this page is available. .

How to: Customize the Appointment Dialog using View Model API (simple customization)

  • 2 minutes to read

Note

The information provided below is relevant only for DevExpress ASP.NET MVC Scheduler version 17.2 and later.

The View Model API enables you to customize dialog element characteristics (values, availability, and layout) as needed.

This topic covers several common scenarios on how to customize the Appointment Dialog’s content and layout using the View Model API. In most cases, the ViewModel.PrepareControlFor and ViewModel.PrepareControl methods are used to access the Appointment Dialog editors.

Note

Online Example A complete sample project demonstrating this approach in action is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T582018

The following code snippets illustrate how to customize editors on the dialog form:

  • Replacing all Toggle editors with Check Boxes

    
    settings.OptionsForms.DialogLayoutSettings.AppointmentDialog.ViewModel.PrepareControl((ASPxCheckBox cb) => {
        cb.ToggleSwitchDisplayMode = ToggleSwitchDisplayMode.Never;
    });
    
  • Changing the “Start” and “End” editors’ DateTime format

    
    settings.OptionsForms.DialogLayoutSettings.AppointmentDialog.ViewModel.PrepareControlFor(m => m.StartTime, (ASPxDateEdit de) => {
        de.EditFormat = EditFormat.Custom;
        de.EditFormatString = "dd - MM - yyyy";
    });
    
    settings.OptionsForms.DialogLayoutSettings.AppointmentDialog.ViewModel.PrepareControlFor(m => m.EndTime, (ASPxDateEdit de) => {
        de.EditFormat = EditFormat.Custom;
        de.EditFormatString = "dd - MM - yyyy";
    });
    
  • Changing the “Resource” editor caption

    
    settings.OptionsForms.DialogLayoutSettings.AppointmentDialog.ViewModel.PrepareControlFor(m => m.ResourceIds, (ASPxComboBox de) => {
        de.Caption = "Employee";
    });
    
  • Changing the “Subject” editor caption’s forecolor and font settings

    
    settings.OptionsForms.DialogLayoutSettings.AppointmentDialog.ViewModel.PrepareControlFor(m => m.Subject, (ASPxTextBox de) => {
        de.CaptionStyle.ForeColor = Color.Red;
        de.CaptionStyle.Font.Bold = true;
    });
    
  • Changing the “Description” editor’s forecolor and font settings.

    
    settings.OptionsForms.DialogLayoutSettings.AppointmentDialog.ViewModel.PrepareControlFor(m => m.Description, (ASPxMemo me) => {
        me.ForeColor = Color.Blue;
        me.Font.Bold = true;
        me.Font.Italic = true;
    });
    
  • Hiding the “Location” and “All-Day” editors

    
    settings.OptionsForms.DialogLayoutSettings.AppointmentDialog.ViewModel.SetItemVisibilityCondition("Location", false);
    settings.OptionsForms.DialogLayoutSettings.AppointmentDialog.ViewModel.SetItemVisibilityCondition(vm => vm.IsAllDay, false);