Back to Devexpress

Floating Action Button

aspnet-120603-components-scheduler-concepts-floating-action-button.md

latest8.2 KB
Original Source

Floating Action Button

  • Dec 17, 2020
  • 3 minutes to read

The Floating Action Button (FAB) is a circular button with an image that appears in front of the scheduler’s content and provides access to the most frequently used actions. The floating action button’s actions depend on the triggered element in the scheduler. For example, the floating action button provides the “Open”, “Edit”, and “Delete” actions if a user selects an appointment or provides the “Create new Appointment” action if a user selects a time cell.

Concept

The floating action button provides two types of actions.

  • Action - Executes the action once an end-user clicks the floating action button.
  • Action group - The floating action button serves as a container for multiple actions. When pressed, the floating action button expands nested actions.

Floating Action Button Object

The scheduler stores the floating action button’s settings in the FloatingActionButtonProperties object that is accessed by the ASPxScheduler.FloatingActionButton property.

PropertyDescription
FloatingActionButtonProperties.TextVisibilityModeSpecifies whether the floating action button’s text should be displayed.
FloatingActionButtonProperties.HorizontalMarginSpecifies the floating action button element’s horizontal margin.
FloatingActionButtonProperties.VerticalMarginSpecifies the floating action button element’s vertical margin.

The floating action button stores its items in the FloatingActionButtonProperties.Items collection that is accessed at the FloatingActionButtonProperties object level.

Action

The following types of actions are available.

ObjectDescription
FABActionRepresents a custom action.
FABCreateAppointmentActionRepresents the “Create an appointment” action.

Use the following settings to customize an action.

PropertyDescription
FABCollectionItemBase.ActionNameSpecifies the action name.
FABActionBase.ContextNameSpecifies the context name.
FABCollectionItemBase.TextSpecifies the floating action button’s text.
FABAction.ImageProvides access to the floating action button’s image settings.
aspx
<dx:ASPxScheduler ID="DemoScheduler" runat="server" Width="100%">
...
    <FloatingActionButton>
        <Items>
            <dx:FABCreateAppointmentAction></dx:FABCreateAppointmentAction>
        </Items>
    </FloatingActionButton>
</dx:ASPxScheduler>

Action Group

The following types of an action group are available.

ObjectDescription
FABActionGroupRepresents a custom group of actions.
FABCreateAppointmentActionGroupRepresents a group of action items that allow you to create an appointment.
FABEditAppointmentActionGroupRepresents a group of action items that allow you to edit an appointment.

Use the following settings to customize an action group.

PropertyDescription
FABActionGroup.ActionNameSpecifies the action group’s name.
FABActionBase.ContextNameSpecifies the context name.
FABCollectionItemBase.TextSpecifies the action group’s text.
FABActionGroup.CollapseImageProvides access to the collapse image settings.
FABActionGroup.ExpandImageProvides access to the expand image settings.
FABCollectionItemBase.CssClassSpecifies the cascading style sheet’s (CSS) class name that specifies the action group’s style.

Action Item

Each action group stores its action items in the Items collection. An action item can be an instance of the following type.

ObjectDescription
FABActionItemRepresents a custom action item.
FABEditAppointmentActionItemRepresents an action item that allows you to edit an appointment.
FABDeleteAppointmentActionItemRepresents an action item that allows you to delete an appointment.
FABCreateRecurringAppointmentActionItemRepresents an action item that allows you to create a recurring appointment.
FABCreateAppointmentActionItemRepresents an action item that allows you to create an appointment.

You can change the following characteristics of an individual action item.

PropertyDescription
FABCollectionItemBase.ActionNameSpecifies the action item’s name.
FABCollectionItemBase.TextSpecifies the action item’s text.
FABActionItem.ImageProvides access to the action item’s image settings.
FABCollectionItemBase.CssClassSpecifies the cascading style sheet’s (CSS) class name that specifies the action item’s style.
aspx
<dx:ASPxScheduler ID="DemoScheduler" runat="server" Width="100%" ClientInstanceName="DemoScheduler" ActiveViewType="FullWeek" GroupType="Resource"
    AppointmentDataSourceID="AppointmentDataSource" ResourceDataSourceID="efResourceDataSource" OnCustomCallback="DemoScheduler_CustomCallback">
    <ClientSideEvents
        SelectionChanged="OnSelectionChanged"
        CustomActionItemClick="OnCustomActionItemClick"
        CellClick="OnCellClick"
        Init="OnInit"
    />
    <FloatingActionButton>
        <Items>
            <dx:FABCreateAppointmentActionGroup></dx:FABCreateAppointmentActionGroup>
            <dx:FABEditAppointmentActionGroup></dx:FABEditAppointmentActionGroup>
            <dx:FABActionGroup ContextName="Scale">
                <ExpandImage Url="../Content/FAB/TimeRulerContext.svg" Width="24px" Height="24px"></ExpandImage>
                <Items>
                    <dx:FABActionItem ActionName="Scale15Minutes">
                        <Image Url="../Content/FAB/15m.svg" Width="32px" Height="32px"></Image>
                    </dx:FABActionItem>
                    <dx:FABActionItem ActionName="Scale30Minutes">
                        <Image Url="../Content/FAB/30m.svg" Width="32px" Height="32px"></Image>
                    </dx:FABActionItem>
                    <dx:FABActionItem ActionName="Scale1Hour">
                        <Image Url="../Content/FAB/1h.svg" Width="32px" Height="32px"></Image>
                    </dx:FABActionItem>
                </Items>
            </dx:FABActionGroup>
        </Items>
    </FloatingActionButton>
...
</dx:ASPxScheduler>