Skip to main content

InplaceEditorEventArgs.InplaceEditorEx Property

Gets or sets the in-place editor which is invoked when an end-user adds a new appointment or edits an existing one “in place”.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v24.1.dll

NuGet Package: DevExpress.Win.Scheduler

Declaration

public ISchedulerInplaceEditorEx InplaceEditorEx { get; set; }

Property Value

Type Description
ISchedulerInplaceEditorEx

A ISchedulerInplaceEditorEx object which represents the in-place editor.

Remarks

By default, the SchedulerControl uses its internal in-place editor, which is inherited from the TextBox class. However, if you’re not satisfied with the current in-place editor, you can create your own custom in-place editor and assign it to the InplaceEditorEventArgs.InplaceEditorEx property.

View Example

private void SchedulerControl1_InplaceEditorShowing(object sender, InplaceEditorEventArgs e) {
    e.InplaceEditorEx = new MyInplaceEditorControl(e.SchedulerInplaceEditorEventArgs);
}

View Example

public class MyInplaceEditorControl : ISchedulerInplaceEditorEx {
    MyInplaceEditor editor;
    Appointment appointment;
    SchedulerControl control;

    public MyInplaceEditorControl(SchedulerInplaceEditorEventArgs inplaceEditorArgs) {
        this.appointment = inplaceEditorArgs.ViewInfo.Appointment;
        this.control = inplaceEditorArgs.Control;
        CreateEditor(inplaceEditorArgs);
    }

    MyInplaceEditor Editor { get { return editor; } }
    Appointment Appointment { get { return appointment; } }
    SchedulerControl Control { get { return control; } }

    public event EventHandler CommitChanges;
    public event EventHandler RollbackChanges;

    void CreateEditor(SchedulerInplaceEditorEventArgs inplaceEditorArgs) {
        this.editor = new MyInplaceEditor(inplaceEditorArgs);
    }

    // Interface implementation 
    public void Dispose() {
        Dispose(true);
        GC.SuppressFinalize(this);
    }
    ~MyInplaceEditorControl() {
        Dispose(false);
    }
    protected virtual void Dispose(bool disposing) {
        if (disposing) {
            if (Editor != null) {
                Editor.Dispose();
                this.editor = null;
            }
            this.appointment = null;
        }
    }
    public virtual void Activate() {
        Editor.FillForm(control, appointment);
        SubscribeEditorEvents();
        Editor.Show(Control.FindForm());
    }
    public virtual void Deactivate() {
        UnsibscribeEditorEvents();
        Editor.Close();
    }
    public virtual void ApplyChanges() {
        Editor.ApplyChanges();
    }
    protected internal virtual void SubscribeEditorEvents() {
        Editor.FormClosed += new FormClosedEventHandler(Editor_FormClosed);
        Editor.Deactivate += new EventHandler(Editor_Deactivate);
        Editor.CommitChanges += new EventHandler(Editor_CommitChanges);
        Editor.RollbackChanges += new EventHandler(Editor_RollbackChanges);
    }

    protected internal virtual void UnsibscribeEditorEvents() {
        Editor.FormClosed -= new FormClosedEventHandler(Editor_FormClosed);
        Editor.Deactivate -= new EventHandler(Editor_Deactivate);
        Editor.CommitChanges -= new EventHandler(Editor_CommitChanges);
        Editor.RollbackChanges -= new EventHandler(Editor_RollbackChanges);
    }
    void Editor_FormClosed(object sender, FormClosedEventArgs e) {
        OnCommitChanges();
    }
    void Editor_Deactivate(object sender, EventArgs e) {
        OnCommitChanges();
    }
    void Editor_RollbackChanges(object sender, EventArgs e) {
        OnRollbackChanges();
    }
    void Editor_CommitChanges(object sender, EventArgs e) {
        OnCommitChanges();
    }
    protected internal virtual void TextBox_LostFocus(object sender, EventArgs e) {
        Editor.Close();
        OnCommitChanges();
    }
    protected internal virtual void OnRollbackChanges() {
        if (RollbackChanges != null)
            RollbackChanges(this, EventArgs.Empty);
    }
    protected internal virtual void OnCommitChanges() {
        RaiseCommitChanges();
    }
    protected internal virtual void RaiseCommitChanges() {
        if (CommitChanges != null)
            CommitChanges(this, EventArgs.Empty);
    }
}

Also available is the InplaceEditorEventArgs.InplaceEditor property that is intended for backward compatibility with editors that implement the ISchedulerInplaceEditor interface.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the InplaceEditorEx property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also