Articles in this section
Category / Section

How to use WinRT SfSchedule commands?

2 mins read

Schedule commands

You can use SfSchedule commands instead of Context Menu to perform the same operation. This article explains how to use the SfSchedule commands in the Schedule. The following Context Menu operations can be handled by using the SfSchedule commands.

1. Adding a new appointment

2. Editing appointments

3. Copy and Paste appointments

4. Deleting appointments

5. DragAndDrop

Using SfSchedule Commands

1. Create a WinRT application and add the SfSchedule control to it. Now create Buttons to perform commands in the click event as in the following code example.

XAML


<Page.Resources>
        <Style TargetType="Button" >
            <Setter Property="Background" Value="Red"></Setter>
            <Setter Property="HorizontalAlignment" Value="Center"></Setter>
            <Setter Property="Width" Value="150"></Setter>            
         </Style> 
    </Page.Resources>
    <Grid Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="0.1*"></RowDefinition>
        </Grid.RowDefinitions>
        <syncfusion:SfSchedule ScheduleType="Month" x:Name="schedule"></syncfusion:SfSchedule>
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Content="Add"  Name="add" Click="add_Click"></Button>
            <Button Content="Edit" Name="edit" Click="edit_Click"></Button>
            <Button Content="Delete"  Name="delete" Click="delete_Click" ></Button>
            <Button Content="Copy"  Name="copy" Click="copy_Click"> </Button>
            <Button Content="Paste" Name="paste" Click="paste_Click_1" ></Button>
            <Button Content="DragAndDrop" Name="drag_drop" Click="drag_drop_Click" ></Button>           
        </StackPanel>
    </Grid>
</Page>

2. Now add the SfSchedule commands in the click event as follows.

C#

private void add_Click(object sender, RoutedEventArgs e)
{
    ScheduleCommands.AddNewCommand.Execute(this.schedule);
}
private void edit_Click(object sender, RoutedEventArgs e)
{
    ScheduleCommands.EditCommand.Execute(this.schedule);
}
private void copy_Click(object sender, RoutedEventArgs e)
{
    ScheduleCommands.CopyCommand.Execute(this.schedule);
}
private void paste_Click_1(object sender, RoutedEventArgs e)
{
    ScheduleCommands.PasteCommand.Execute(this.schedule);
}
private void delete_Click(object sender, RoutedEventArgs e)
{
    ScheduleCommands.DeleteCommand.Execute(this.schedule);
}        
private void drag_drop_Click(object sender, RoutedEventArgs e)
{
    ScheduleCommands.DragAndDropCommand.Execute(this.schedule);
}      

The following screenshots display the different SfSchedule command operations.

1. Adding a new appointment

Click the Add button to add appointments in the Schedule.

Adding new appointment using add button

Figure 1: Adding new appointment using Add button

 

Appointment created using add button

Figure 2: Appointment created using Add button

 

2. Editing Appointments

For editing the appointments, select any of the appointments in the Schedule and click the Edit button.

Editing appointments using edit button

Figure 3: Editing appointments using Edit button

 

3. Copy and Paste Appointments

For copying appointments, select any of the appointments in the Schedule and click the Copy button. Then paste the appointment in Schedule using the Paste button.

Copy and paste appointments

Figure 4: Copy and paste appointments

4. Deleting appointments

For deleting appointments, select any of the appointments in the Schedule and click the Delete button.

Deleting appointments using delete button

Figure 5: Deleting appointments using Delete button

 

5. DragAndDrop

For doing DragAndDrop, select any of the appointments in the Schedule and click the DragAndDrop button.

Drap and drop the appointments

Figure 6: Drag and Drop the appointments

 

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