Back to Devexpress

AppointmentEditPage Class

maui-devexpress-dot-maui-dot-scheduler-4ff04847.md

latest5.9 KB
Original Source

AppointmentEditPage Class

The page that allows users to add new and edit existing appointments.

Namespace : DevExpress.Maui.Scheduler

Assembly : DevExpress.Maui.Scheduler.dll

NuGet Package : DevExpress.Maui.Scheduler

Declaration

csharp
[XamlFilePath("Pages/AppointmentEditPage.xaml")]
public class AppointmentEditPage :
    ContentPage,
    IDialogService

Remarks

This page looks as follows:

Important

The page must be non-modally pushed (via the INavigation.PushAsync method) to the navigation stack that contains the scheduler view’s page. The back button is hidden when you add the page to a new navigation stack.

Example

This example displays AppointmentEditPage to edit general appointment, pattern, occurrence, or to add a new appointment when a user taps on the scheduler day view:

csharp
const string EditPatternAction = "Edit pattern";
const string EditOccurrenceAction = "Edit occurrence";
const string EditNormalAction = "Edit";

async void Handle_OnTap(object sender, SchedulerGestureEventArgs e) {
    if (e.AppointmentInfo != null) {
        string selectedAction = await DisplaySelectAppointmentEditActionSheet(e.AppointmentInfo.Appointment);
        switch (selectedAction) {
            case EditPatternAction:
                PushEditAppointmentPage(storage.GetPattern(e.AppointmentInfo.Appointment));
                break;
            case EditOccurrenceAction:
            case EditNormalAction:
                PushEditAppointmentPage(e.AppointmentInfo.Appointment);
                break;
            default:
                break;
        }
    } else {
        if (e.IntervalInfo != null) { PushNewAppointmentPage(e.IntervalInfo); }
    }
}

async void PushEditAppointmentPage(AppointmentItem target) {
    var page = new AppointmentEditPage(target, storage);
    await Navigation.PushAsync(page);
}
async void PushNewAppointmentPage(IntervalInfo info) {
    var page = new AppointmentEditPage(info.Start, info.End, info.AllDay, storage);
    await Navigation.PushAsync(page);
}

async Task<String> DisplaySelectAppointmentEditActionSheet(AppointmentItem target) {
    string[] actions = null;
    string deleteAction = null;
    switch (target.Type) {
        case AppointmentType.Normal:
            actions = new string[] { EditNormalAction };
            break;
        default:
            actions = new string[] { EditPatternAction, EditOccurrenceAction };
            break;
    }
    return await this.DisplayActionSheet(null, "Cancel", null, actions);
}
xml
<dxs:DayView Tap="Handle_OnTap">
    <dxsch:DayView.DataStorage>
        <dxsch:SchedulerDataStorage x:Name="storage">
            <!-- ... -->
        </dxsch:SchedulerDataStorage>
    </dxsch:DayView.DataStorage>
</dxs:DayView>

The following table contains classes and members the example uses:

|

Symbol

|

Description

| | --- | --- | |

ViewBase.Tap

|

Fires when users tap on the scheduler view.

| |

SchedulerDataStorage.GetPattern(AppointmentItem)

|

Returns a pattern of the specified occurrence or exception.

| |

AppointmentEditPage

|

The page that allows users to add new and edit existing appointments.

|

Implements

Show 15 items

INotifyPropertyChanged

IAnimatable

Microsoft.Maui.Controls.ITabStopElement

ILayout

IPageController

IVisualElementController

IElementController

IElementConfiguration<Page>

Microsoft.Maui.IPage

IHotReloadableView

IView

Microsoft.Maui.IFrameworkElement

ITransform

IReplaceableView

IDialogService

Inheritance

System.Object BindableObject Element NavigableElement VisualElement Page TemplatedPage ContentPage AppointmentEditPage

Extension Methods

Yield<AppointmentEditPage>()

YieldIfNotNull<AppointmentEditPage>()

See Also

AppointmentEditPage Members

DevExpress.Maui.Scheduler Namespace