)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use WPF SfSchedule commands?

Platform: WPF |
Control: SfSchedule |
Published Date: February 28, 2015 |
Last Revised Date: January 29, 2020
Tags: sfschedule

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 WPF 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

<Window.Resources>
      <Style TargetType="Button" >
          <Setter Property="Margin" Value="5"></Setter>
          <Setter Property="Background" Value="LightSlateGray"></Setter>
          <Setter Property="HorizontalAlignment" Value="Center"></Setter>
          <Setter Property="Width" Value="150"></Setter>
          <Setter Property="FontSize" Value="20"></Setter>
      </Style>
</Window.Resources>
<Grid>
      <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>

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

To copy 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 the appointments

Figure 4: Copy and Paste Appointments

 

4. Deleting Appointments

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

Delete the appointment 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.

Drag and drop the appointments

Figure 6: Drag and Drop the appointments

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon