Articles in this section
Category / Section

How to add an appointment using the context menu in WPF Scheduler (Calendar)

1 min read

In WPF SfScheduler, you can use CellContextMenu and AppointmentContextMenu options for add, remove, edit the appointments using inbuilt Add, Edit and Delete command.

XAML

CommandParameter of CellContextMenu, AppointmentContextMenu as SchedulerContextMenuInfo that contains the Appointment or DateTime of the corresponding cell, based on this you can add, delete, edit the appointments.

<syncfusion:SfScheduler x:Name="Schedule" 
        ViewType="Week">
    <syncfusion:SfScheduler.CellContextMenu>
        <ContextMenu>
            <MenuItem 
                        
Command="{Binding Source={x:Static Member=syncfusion:SchedulerCommands.Add}}" CommandParameter ="{Binding}" CommandTarget="{Binding ElementName=Schedule}" Header="Add">
                <MenuItem.Icon>
                    <Path x:Name="AddNew" Data="{StaticResource addNew}"
        Fill="#FF5A5A5B" 
        Width="16"
        Height="16"
        HorizontalAlignment="Center"
        VerticalAlignment="Center"
        Stretch="Fill" />
                </MenuItem.Icon>
            </MenuItem>
 
        </ContextMenu>
    </syncfusion:SfScheduler.CellContextMenu>
    <syncfusion:SfScheduler.AppointmentContextMenu>
        <ContextMenu>
            <MenuItem Command="{Binding Source={x:Static Member=syncfusion:SchedulerCommands.Edit}}"
CommandParameter ="{Binding}" CommandTarget="{Binding ElementName=Schedule}"
Header="Edit">
                <MenuItem.Icon>
                    <Path x:Name="Edit" Data="{StaticResource edit}"
    Fill="#FF5A5A5B" 
        Width="16"
        Height="16"
        HorizontalAlignment="Center"
        VerticalAlignment="Center"
        Stretch="Fill"/>
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Command="{Binding Source={x:Static Member=syncfusion:SchedulerCommands.Delete}}"
CommandParameter ="{Binding}"
Header="Delete">
                <MenuItem.Icon>
                    <Path x:Name="Delete" Data="{StaticResource delete}"
        Fill="#FF5A5A5B" 
        Width="16"
        Height="16"
        HorizontalAlignment="Center"
        VerticalAlignment="Center"
        Stretch="Fill"/>
                </MenuItem.Icon>
            </MenuItem>
        </ContextMenu>
    </syncfusion:SfScheduler.AppointmentContextMenu>
</syncfusion:SfScheduler>

View sample in GitHub

WPF Scheduler add context Meny

WPF Scheduler edit, delete context menu

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied