Using the custom Style for an Appointment view you can assign the context menu to appointments. Here is what to do:

1. Create Context Menu as part of your application or window resources. For example:

<ContextMenu x:Key=”AppContextMenu”>

<MenuItem Header=”Item 1″ />

<MenuItem Header=”Item 2″ />

<MenuItem Header=”Item 3″ />


2. Create custom style for AppointmentView like such:

<Style TargetType=”{x:Type s:AppointmentView}” x:Key=”{ComponentResourceKey TypeInTargetAssembly=local:Window1, ResourceId=AppView}”>

<Setter Property=”ContextMenu” Value=”{StaticResource AppContextMenu}” />


3. Assign custom style to your appointment, for example:

Appointment appointment = new Appointment();

appointment.Subject = “Appointment with Context Menu”;

appointment.StartTime = DateTime.Today.AddHours(9);

appointment.EndTime = appointment.StartTime.AddHours(1);

appointment.StyleResourceName = new ComponentResourceKey(typeof(Window1), “AppView”);

// Add appointment to the model


From your context menu handlers, like Command.Executed event, you can use CalendarView.SelectedAppointments collection to get which appointments were right-clicked.

Related posts:

  1. How to set custom Style for Appointment Views
  2. How to enumerate all Appointments between two dates in Schedule control
  3. WPF Schedule Quick Start Guide
  4. How to disable end-user right-click context customization menu
  5. How to Create WPF Navigation Pane Items Using Code