Version

Configuring xamGantt Additional Context Menus

Topic Overview

Purpose

This topic describes how you can configure the xamGantt™'s context menus and add additional context menus for predefined areas of the xamGantt control.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic describes how you can add the xamGantt control to a page.

In order to get you up and running as quickly as possible with the xamContexMenu control, we’ve provided you with information on how to get started using the control.

XamGantt Context Menus Overview

Introduction

The xamGantt control comes with a set of built-in context menus. In addition, you can add your own custom context menu for a predefined set of xamGantt areas or, if you want, to override an existing context menu.

XamGantt uses an instance of the GanttContextMenuProvider class to define the default context menus. Context menus are identified by the GanttContextMenuArea enumeration.

Gantt Context Menu Provider

You can use the GanttContextMenuProvider’s ResourceOverrides property to add a custom ResourceDictionary. In this ResourceDictionary you can specify your additional context menus.

Gantt Context Menu Area

GanttContextMenuArea enumeration is used to identify the context menus. XamGantt comes with default menus for members of this enumeration and you have the ability to add context menus for other members of the enumeration or to override the existing context menus.

Member Description Built-in menu

Cell

The context menu for the data cells in the grid section.

xamGantt Configuring xamGantt Additional Context menus 1.png

ColumnHeader

The context menu for the column headers in the grid section.

xamGantt Configuring xamGantt Additional Context menus 1.png

Grid

The context menu for the empty portion of the grid section.

xamGantt Configuring xamGantt Additional Context menus 1.png

Row

The context menu for a row in the grid section.

xamGantt Configuring xamGantt Additional Context menus 1.png

RowSelectorHeader

The context menu for the header cell of the row selectors in the grid section.

xamGantt Configuring xamGantt Additional Context menus 1.png

Task

The context menu for the task in chart section.

xamGantt Configuring xamGantt Additional Context menus 1.png

TaskDependency

The context menu for the task dependency in the chart section.

xamGantt Configuring xamGantt Additional Context menus 1.png

TimescaleArea

The context menu for the timescale area in the chart section.

xamGantt Configuring xamGantt Additional Context menus 8.png

TimescaleBandHeader

The context menu for the timescale band header in the chart section.

xamGantt Configuring xamGantt Additional Context menus 8.png

TimescaleHeader

The context menu for the timescale header presenter in the chart section.

xamGantt Configuring xamGantt Additional Context menus 8.png

Code Example: Creating Additional Context Menus for xamGantt chart section

Description

This code example shows you how to create additional context menus for TimescaleArea and TimescaleBandHeader for xamGantt . It adds a resource dictionary to the GanttContexMenuProvider.ResourceOverrides. In the resource dictionary there are defined two xamContextMenu, one for the TimescaleArea and one for the TimescaleBandHeader area.

Note
Note

You have to specify the name of the GanttContexMenuArea member as a key for the context menu in order to associate the context menu with this area.

Prerequisites

  • To complete the code example, you should have a xamGantt project. You can follow the instructions in Adding xamGantt to a Page in order to create sample xamGantt project.

  • You must also change the mark-up for the xamGantt to coincide with example shown in code section of this topic.

Preview

This is a preview of a completed sample project. You can see the additional context menu for the timescale band header area.

xamGantt Configuring xamGantt Additional Context menus 11.png

Code

In XAML:

<ig:XamGantt x:Name="xamGantt" Project="{Binding Project}">
    <ig:XamGantt.ContextMenuProvider>
        <ig:GanttContextMenuProvider>
            <ig:GanttContextMenuProvider.ResourceOverrides>
                <ResourceDictionary>
                    <ig:XamContextMenu x:Key="TimescaleArea">
                        <ig:XamMenuItem Header="Show timescale..." />
                        <ig:XamMenuItem Header="Show split..." />
                    </ig:XamContextMenu>
                    <ig:XamContextMenu x:Key="TimescaleBandHeader">
                        <ig:XamMenuItem Header="Timescale ..." />
                        <ig:XamMenuItem Header="Zoom..." />
                        <ig:XamMenuItem Header="Change working time..." />
                        <ig:XamMenuItem Header="More..." />
                    </ig:XamContextMenu>
                </ResourceDictionary>
            </ig:GanttContextMenuProvider.ResourceOverrides>
        </ig:GanttContextMenuProvider>
    </ig:XamGantt.ContextMenuProvider>
</ig:XamGantt>

The following topics provide additional information related to this topic:

Topic Purpose

The topics in this group contains information about the xamGantt control, ranging from what the control does to step-by-step procedures on using it in your application.