Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Collapse]Scheduler
   [Expand]Product Information
   [Collapse]Getting Started
     Lesson 1 - Create a Simple Scheduling Application
     Lesson 2 - Create a Simple Scheduling Application with DateNavigator
     Lesson 3 - Provide Bar UI for a Scheduler
     Lesson 4 - Provide Ribbon UI for a Scheduler
     Lesson 5 - Bind a Scheduler to MS SQL Database at Design Time
     Lesson 6 - Bind a Scheduler to MS Access Database at Design Time
     Lesson 7 - Create a Custom Appointment Edit Form
     Lesson 8 - Implement a Custom Inplace Editor
   [Expand]Fundamentals
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Lesson 8 - Implement a Custom Inplace Editor

The following example demonstrates how to customize an inplace editor. An inplace editor (sometimes called an inline editor, since it is intended for inline editing) is activated when an end-user adds a new appointment by pressing the Enter key in selected cells, or edits the appointment's Appointment.Subject by pressing the F2 key when the appointment is selected, or by single-clicking it (a double click opens the Appointment Editing Form).

An inplace editor in the Scheduler is different from an inplace editor in the Data Grid because the inplace editor in the Scheduler is a separate form that can be shown in any location. Inplace editors for the Scheduler do not use repository item collections. To display an inplace editor to the user, handle the SchedulerControl.InplaceEditorShowing event, and specify the editor using the InplaceEditorEventArgs.InplaceEditor property or the InplaceEditorEventArgs.InplaceEditorEx property. The inplace editor must implement the ISchedulerInplaceEditor or the ISchedulerInplaceEditorEx interface.

Note

You can set restrictions on inplace editing by setting the SchedulerOptionsCustomization.AllowInplaceEditor property value. For example, set the property to UsedAppointmentType.None to disable inline editing, or set it to UsedAppointmentType.Custom to raise the SchedulerControl.AllowInplaceEditor event, which enables you to decide whether or not to invoke the editor.

To implement a custom inplace editor and use it instead of the default inplace editor, follow the instructions below.

Expanded Create a Sample Application

Create a new scheduling application by following the instructions in the Lesson 5 - Bind a Scheduler to MS SQL Database at Design Time document of the current Getting Started tutorial.

Expanded Create an Inplace Editor Form Layout

The following steps assume that you create the project in C#. However, if you choose a Visual Basic project, the actions will be the same.

  1. In the Visual Studio Designer, press CTRL+SHIFT+A to invoke the Add New Item dialog. In this dialog, select DevExpress v17.1 Template Gallery and click Add.

    You can also invoke this dialog by selecting the DevExpress -> All Platforms -> New Item... menu in the Visual Studio esigner.

  2. In the DevExpress Template Gallery window, select Form and specify MyInplaceEditor as the name of the new form. Click Add Item.

  3. Locate the LayoutControl component in the Toolbox and drop it onto the form. In the Properties grid, set the LayoutControl's Dock property to Fill, so that the control occupies the entire form. For more information on the Layout component, refer to the Tutorial: Creating a Simple Data Layout document.

  4. Add a control that will be used to edit the Appointment.Subject property. To accomplish this, locate the TextEdit control in the Toolbox and drop it onto the LayoutControl.

  5. Change the text of the newly created layoutControlItem1 to Subject:. Change the name of the textEdit1 control to edtSubject.

  6. Add a control that will be used to edit the Appointment.LabelId property. Locate the AppointmentLabelEdit control in the Toolbox and drop it onto the LayoutControl. Change the text of the newly created layoutControlItem2 to Label:.

  7. Add a control that will be used to edit the Appointment.Description property. Locate the MemoEdit control in the Toolbox and drop it onto the LayoutControl. Change the text of the newly created layoutControlItem3 to Description:. Change the name of the memoEdit1 control to edtDescription.

  8. To improve the form layout, do the following.

    • Hide the Control/System menu box by setting the ControlBox property to false.
    • Set the Text property to an empty string to hide the form's caption.
    • Specify the minimum size of the form using the MinimumSize property. Set the minimum width to 132, and set the minimum height to 192.
    • Set the StartPosition property to Manual.
    • Set the BaseLayoutItem.TextLocation for each LayoutControlItem to Top.

    The result is shown below.

Expanded Add the Code to Implement the Edit Functionality

Open the MyInplaceEditor.cs code file and replace the content of the public partial class MyInplaceEditor with the following code. Add using (Imports for Visual Basic) namespace directive for the DevExpress.XtraScheduler namespace.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4826.

Expanded Implement an Inplace Editor Control

The Scheduler requires an object that implements the ISchedulerInplaceEditorEx interface to use it as an inplace editor. Thus, you need to create a container object for your custom form. This container should implement the ISchedulerInplaceEditorEx interface (the container is also responsible for instantiating and positioning the MyInplaceEditor form).

To create a container class, add a new class file named MyInplaceEditorControl to the project. Copy and paste the following code to replace the default class content.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4826.

Expanded Add the Code to Display a Custom Inplace Editor

To display a custom form instead of the default inplace editor, subscribe to the SchedulerControl.InplaceEditorShowing event and handle it as follows.

Expanded Run the Project

Run the project, and type in the Scheduler view to create a new appointment or click an existing appointment. The inplace editor appears as illustrated in the picture below.

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