Back to Devexpress

DxScheduler.ShowAppointmentTooltipAsync(DxSchedulerAppointmentItem, DxSchedulerResourceItem) Method

blazor-devexpress-dot-blazor-dot-dxscheduler-dot-showappointmenttooltipasync-x28-devexpress-dot-blazor-dot-dxschedulerappointmentitem-devexpress-dot-blazor-dot-dxschedulerresourceitem-x29.md

latest7.8 KB
Original Source

DxScheduler.ShowAppointmentTooltipAsync(DxSchedulerAppointmentItem, DxSchedulerResourceItem) Method

Shows an appointment tooltip.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public Task ShowAppointmentTooltipAsync(
    DxSchedulerAppointmentItem appointment = null,
    DxSchedulerResourceItem resource = null
)

Optional Parameters

NameTypeDefaultDescription
appointmentDxSchedulerAppointmentItemnull

The appointment for which to show the tooltip. null to pass the selected appointment.

| | resource | DxSchedulerResourceItem | null |

The appointment resource to show in the tooltip. null to prevent resources from appearing in the tooltip.

|

Returns

TypeDescription
Task

The task that is completed when an appointment tooltip is shown.

|

Remarks

You can use the ShowAppointmentTooltipAsync method to show an appointment’s tooltip in code.

The following code snippet customizes the header of the extended edit form (AppointmentFormHeaderTemplate). The header displays the following elements:

razor
<DxScheduler StartDate="@DateTime.Today"
             DataStorage="@DataStorage"
             @ref="Scheduler">
    <Views>
        <DxSchedulerWeekView ShowWorkTimeOnly="false"
                             TimeIndicatorVisibility="SchedulerTimeIndicatorVisibility.Never"
                             TimeScale="@(new TimeSpan(0,15,0))"
                             WorkTime="@(new DxSchedulerTimeSpanRange(TimeSpan.FromHours(9), TimeSpan.FromHours(18)))"
                             VisibleTime="@(new DxSchedulerTimeSpanRange(TimeSpan.FromHours(8), TimeSpan.FromHours(19)))">
        </DxSchedulerWeekView>
    </Views>
    <AppointmentCompactFormHeaderTemplate>
        <div class="popup-text-header">@context.Subject</div>
        <DxButton Click="@(() => Scheduler.ShowAppointmentTooltipAsync())"
                  Text="Show Tooltip"
                  IconCssClass="oi oi-browser"
                  RenderStyle="ButtonRenderStyle.None"
                  CssClass="custom-button">
        </DxButton>
    </AppointmentCompactFormHeaderTemplate>
</DxScheduler>

@code {
    ISchedulerAppointmentActions Scheduler { get; set; }

    DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
        AppointmentsSource = AppointmentCollection.GetAppointments(),
        AppointmentMappings = new DxSchedulerAppointmentMappings() {
            Type = "AppointmentType",
            Start = "StartDate",
            End = "EndDate",
            Subject = "Caption",
            AllDay = "AllDay",
            Location = "Location",
            Description = "Description",
            LabelId = "Label",
            StatusId = "Status",
            RecurrenceInfo = "Recurrence"
        }
    };
}
css
.popup-text-header {
    margin-right: auto;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.custom-button {
    color: white;
}
csharp
using System;

namespace Scheduler.Data
{
    public class Appointment {
        public Appointment() { }
        public int AppointmentType { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
        public string Caption { get; set; }
        public string Description { get; set; }
        public string Location { get; set; }
        public int? Label { get; set; }
        public int Status { get; set; }
        public bool AllDay { get; set; }
        public string Recurrence { get; set; }
        public int? ResourceId { get; set; }
        public bool Accepted { get; set; }
    }
}
csharp
using System;
using System.Collections.Generic;
using System.Globalization;

namespace Scheduler.Data
{
    public static partial class AppointmentCollection {
        public static List<Appointment> GetAppointments()
        {
            DateTime date = DateTime.Today;
            var dataSource = new List<Appointment>() {
               new Appointment {
                   Caption = "Upgrade Personal Computers",
                   StartDate = date + (new TimeSpan(0, 14, 0, 0)),
                   EndDate = date + (new TimeSpan(0, 16, 30, 0)),
                   Label = 1,
                   Status = 1
               },
               new Appointment {
                   Caption = "Install New Router in Dev Room",
                   StartDate = date + (new TimeSpan(0, 11, 30, 0)),
                   EndDate = date + (new TimeSpan(0, 13, 30, 0)),
                   Label = 6,
                   Status = 1
               },
               new Appointment {
                   Caption = "New Brochures",
                   StartDate = date + (new TimeSpan(1, 15, 00, 0)),
                   EndDate = date + (new TimeSpan(1, 16, 45, 0)),
                   Label = 8,
                   Status = 1
               },
               new Appointment {
                   Caption = "Approve Personal Computer Upgrade Plan",
                   StartDate = date + (new TimeSpan(3, 13, 30, 0)),
                   EndDate = date + (new TimeSpan(3, 16, 0, 0)),
                   Label = 1,
                   Status = 1
               },
               new Appointment {
                   Caption = "Customer Workshop",
                   StartDate = date + (new TimeSpan(4, 11, 0, 0)),
                   EndDate = date + (new TimeSpan(4, 12, 0, 0)),
                   AllDay = true,
                   Label = 8,
                   Status = 1
               },
               new Appointment {
                   Caption = "Upgrade Server Hardware",
                   StartDate = date + (new TimeSpan(6, 11, 0, 0)),
                   EndDate = date + (new TimeSpan(6, 13, 30, 0)),
                   Label = 6,
                   Status = 1
               },
               new Appointment {
                   AppointmentType = 1,
                   Caption = "Daily Meeting",
                   StartDate = date + (new TimeSpan(0, 9, 00, 0)),
                   EndDate = date + (new TimeSpan(0, 10, 00, 0)),
                   Label = 10,
                   Status = 1,
                   Recurrence = string.Format("<RecurrenceInfo Type=\"0\" Start=\"{0}\" Range=\"1\" OccurrenceCount=\"10\" Frequency =\"1\" Id=\"72e3db8f-cdb6-4aaa-afe1-e3c6b80ce995\"/>", ToString(date + (new TimeSpan(0, 9, 00, 0))))
               }
           };
            return dataSource;
        }

        private static string ToString(DateTime dateTime) {
            return dateTime.ToString(CultureInfo.InvariantCulture);
        }
    }
}

Implements

ShowAppointmentTooltipAsync(DxSchedulerAppointmentItem, DxSchedulerResourceItem)

See Also

DxScheduler Class

DxScheduler Members

DevExpress.Blazor Namespace