
Syncfusion Blazor Gantt Chart
- 230 installs
- 4 repo stars
- Updated July 28, 2026
- syncfusion/blazor-ui-components-skills
Use syncfusion-blazor-gantt-chart for development tasks
About
syncfusion-blazor-gantt-chart: A skill for development. This provides functionality for development workflows.
- syncfusion-blazor-gantt-chart
Syncfusion Blazor Gantt Chart by the numbers
- 230 all-time installs (skills.sh)
- +13 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Ranked #1,668 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/syncfusion/blazor-ui-components-skills --skill syncfusion-blazor-gantt-chartAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 230 |
|---|---|
| repo stars | ★ 4 |
| Last updated | July 28, 2026 |
| Repository | syncfusion/blazor-ui-components-skills ↗ |
What it does
Use syncfusion-blazor-gantt-chart for development tasks
Files
Implementing Syncfusion Blazor Gantt Chart
When to Use This Skill
Use this skill when the user needs to:
- Implement project scheduling interfaces similar to Microsoft Project with visual timeline and task management
- Display hierarchical task structures with parent-child relationships, dependencies, and progress tracking
- Enable interactive timeline editing through drag-and-drop taskbars, resize operations, and dependency linking
- Manage project resources including personnel allocation, workload tracking, and overallocation detection
- Configure complex timelines with custom zoom levels, working hours, holidays, time zones, and duration units
- Export project data to Excel, CSV, or PDF formats with customizable layouts and styling
- Handle remote data through Entity Framework, Dapper, custom adaptors, or REST API connections
- Implement critical path analysis for identifying tasks that impact project completion dates
- Create resource views showing task allocation and utilization across team members and equipment
This skill provides comprehensive guidance for the SfGantt<TValue> component, covering all aspects from basic setup through advanced features like split tasks, baseline tracking, and custom PDF exports.
---
Documentation and Navigation Guide
This skill is organized into 14 major sections. Each section contains focused reference files covering specific features. Use this navigation guide to identify which reference to read based on the user's needs.
---
1. Getting Started
When to read: Initial setup, installation, platform-specific configuration
📄 Read: references/getting-started-webassembly.md
- NuGet package installation for Blazor WebAssembly
- Basic component setup and registration
- CSS theme imports and configuration
- First minimal Gantt chart example
- Task data model and field mapping
📄 Read: references/getting-started-server.md
- Blazor Server-specific setup and services
- Service registration in Program.cs
- Component initialization differences
---
2. Data Binding and Remote Data
When to read: Setting up data sources, connecting to databases, custom data adaptors
📄 Read: references/data-binding-and-field-mapping.md
- Hierarchical and self-referential data structures
- GanttTaskFields configuration and mapping
- Required vs optional fields
- SfDataManager integration
- Load-on-demand for large datasets
📄 Read: references/remote-data-adaptors.md
- UrlAdaptor for REST APIs
- Custom DataAdaptor implementation
- Handling CRUD, search, filter, sort operations
- Injecting services and passing parameters
---
3. Task Management
When to read: Creating, editing, deleting tasks, dependencies, scheduling, undo/redo, critical path
📄 Read: references/task-scheduling-and-hierarchy.md
- Nested hierarchical vs self-referential (ParentID) data structures
- Task types: parent (rollup), child (work item), milestone (zero-duration), unscheduled
- Auto-scheduling and manual scheduling approaches
- Duration units: Day, Hour, Minute
- Hierarchy effects: parent rollup, expand/collapse, indent/outdent
📄 Read: references/task-crud-operations.md
- Enable editing — GanttEditSettings (AllowAdding, AllowEditing, AllowDeleting, AllowTaskbarEditing)
- Edit modes — Auto, Dialog, Taskbar
- Adding tasks via toolbar, context menu, or programmatic API
- Dialog customization — expose only selected fields in the edit form
- Remote CRUD — InsertUrl, UpdateUrl, RemoveUrl, BatchUrl
- Delete behavior — cascade rules and child handling
📄 Read: references/task-dependencies-and-validation.md
- Dependency types: FS, SS, FF, SF
- Predecessor field mapping via GanttTaskFields.Dependency
- Dependency string format (e.g.,
3FS,5SS+2d) - Circular dependency detection
- Auto-scheduling interaction with dependency changes
📄 Read: references/critical-path-and-analysis.md
- EnableCriticalPath — highlights critical tasks in red automatically
- GanttCriticalPathSettings.SlackValue — widen critical zone to near-critical tasks
- "CriticalPath" toolbar item — user-facing toggle
- QueryChartRowInfo + GanttTaskModel.IsCritical — custom critical taskbar color/style
- GetCriticalTasksAsync() — retrieve critical task list programmatically
- Calculation rules: progress < 100%, dependency-driven, recalculates on every change
📄 Read: references/undo-redo-and-state.md
- EnableUndoRedo + UndoRedoActions list — track 23 action types (Add, Edit, Delete, TaskbarEdit, Sort, Filter, ZoomIn/Out, Indent/Outdent, RowDragAndDrop, etc.)
- MaxUndoRedoSteps — limit history size (default: 20)
- UndoAsync() / RedoAsync() — programmatic undo/redo
- "Undo" / "Redo" toolbar items — keyboard shortcut Ctrl+Z / Ctrl+Y
- OnUndoRedo event — react after undo/redo with CanUndo/CanRedo state
- State preservation patterns — expand/collapse, selection, zoom, filters, scroll position
---
4. Timeline Configuration
When to read: Timeline views, zoom levels, working hours, holidays, time zones, effort tracking
📄 Read: references/timeline-configuration.md
- Single-tier vs dual-tier timeline layouts
- GanttTimelineSettings, GanttTopTierSettings, GanttBottomTierSettings
- TimelineViewMode units: Hour, Day, Week, Month, Year
- TimelineUnitSize — controls cell width / density
- Format strings for tier labels
- ProjectStartDate / ProjectEndDate for visible date range
📄 Read: references/zooming-and-view-control.md
- ZoomIn, ZoomOut, ZoomToFit toolbar items
- ZoomToFit — fits the entire schedule into the visible viewport
- Programmatic zoom via toolbar or code
- Recommended defaults: day/week for operational, week/month for roadmap views
📄 Read: references/working-time-holidays-timezone.md
- DayWorkingTime — define working hours per day (e.g., 8-hour day)
- WorkWeek — specify which days are working days
- GanttHolidays / GanttHoliday — non-working dates with From/To/Label
- Timezone considerations for multi-region teams
- Impact on task duration calculations and auto-scheduling
📄 Read: references/work-and-effort-tracking.md
- Work field mapping in GanttTaskFields.Work
- Task types: FixedDuration, FixedWork, FixedUnit
- Work = Duration × WorkingHoursPerDay × (Unit / 100)
- Resource allocation units affect work calculation
- WorkUnit property (Hour, Day, Minute)
---
5. Resources
When to read: Resource assignment, resource views, overallocation detection, assignment CRUD
📄 Read: references/resources-and-allocation.md
- GanttResource — DataSource, Id, Name, MaxUnits, Group field mappings
- GanttAssignmentFields — PrimaryKey, TaskID, ResourceID, Units
- ResourceData model (ResourceId, ResourceName, MaxUnit) + AssignmentModel (PrimaryId, TaskID, ResourceId, Unit)
- Assign resources via cell editing (GanttResourceColumn), dialog, or programmatically
- AddResourceAssignmentAsync / UpdateResourceAssignmentAsync / DeleteResourceAssignmentAsync
- Task types with resources: FixedDuration, FixedWork, FixedUnit
- ViewType.ResourceView — resource-centric hierarchy (resources as parents, tasks as children)
- ShowOverallocation="true" — highlights over-allocated date ranges in resource view
- Over-allocation = daily work from all tasks > DayWorkingHours × MaxUnits / 100
- GanttLabelSettings.RightLabel="Resources" — show resource names in taskbar label
📄 Read: references/assignment-fields-and-resource-mapping.md
- GanttAssignmentFields\<TValue, TAssignment\> class and properties
- Resource assignment collection and foreign key relationships
- AddResourceAssignmentAsync, UpdateResourceAssignmentAsync, DeleteResourceAssignmentAsync
- Many-to-many task-resource mapping patterns
- Resource allocation units and percentage tracking
---
6. Task Segments and Splitting
When to read: Split tasks, task segments, interrupted schedules, paused work
📄 Read: references/segment-fields-and-split-tasks.md
- GanttSegmentFields\<TValue, TSegments\> — PrimaryKey, TaskID, StartDate, EndDate field mappings
- Segment data model: separate collection linked to tasks via TaskID
- SplitTaskAsync — split a task at a specified date programmatically
- MergeTaskAsync — merge segments back into a single task
- UI-based splitting via context menu or dialog
- Segment taskbar rendering — multiple connected bars with gaps
- Use cases: planned breaks, resource unavailability, approval pauses
---
7. Visualization
When to read: Taskbar templates, baselines, markers, labels, interactive taskbar editing
📄 Read: references/taskbar-and-templates.md
- GanttTemplates.TaskbarTemplate — custom RenderFragment for taskbar content
- GanttTooltipSettings.TaskbarTemplate — custom tooltip content
- ShowBaseline / BaselineColor / BaselineStart / BaselineEnd — planned vs actual comparison
- TaskbarHeight / RowHeight — size control
- Performance note: combine complex templates with EnableVirtualization
📄 Read: references/markers-and-labels.md
- GanttEventMarkers / GanttEventMarker — vertical timeline lines with Date, Text, CssClass
- GanttLabelSettings — LeftLabel, RightLabel, TopLabel with field name or template
- Data markers via TaskbarTemplate — conditional icons based on task properties
- Limit markers to essential dates to avoid timeline clutter
📄 Read: references/taskbar-editing.md
- AllowTaskbarEditing="true" in GanttEditSettings
- Drag to move task — updates StartDate and EndDate
- Resize left/right handle — adjusts start or end date
- Drag progress handle — updates Progress field
- TaskbarEdited event — receives TaskbarEditedEventArgs\<TValue\>
- OnActionBegin — validate or cancel taskbar edits via args.Cancel
---
8. Grid Columns
When to read: Column configuration, types, formatting, show/hide, autofit, validation, reordering, resizing, frozen columns, column menu
📄 Read: references/column-basics-and-formatting.md
- GanttColumn definition (Field, HeaderText, Width, TextAlign, Format, Type, Visible)
- Column types including DateOnly, TimeOnly, Checkbox
- Number formatting (N, C, P variants) and date formatting (custom pattern strings)
- AutoFit columns — AutoFitColumnsAsync called in DataBound event
- Show or hide columns programmatically — ShowColumnsAsync / HideColumnsAsync
- TreeColumnIndex — move expand/collapse tree icons to a different column
- HideAtMedia — responsive columns via CSS media queries
- Per-column action controls: AllowEditing, AllowFiltering, AllowSorting, AllowReordering, AllowResizing
📄 Read: references/column-interactions.md
- Column reordering — AllowReordering on SfGantt and per-column override
- Column resizing — AllowResizing, MinWidth, MaxWidth; double-click to autofit
- Frozen columns — FrozenColumns (first N) vs IsFrozen per column (not combinable)
- Freeze direction — FreezeDirection.Left / FreezeDirection.Right with IsFrozen
- Draggable freeze line — AllowFreezeLineMoving
- Column menu — ShowColumnMenu on SfGantt with required companions (AllowSorting, AllowFiltering, AllowResizing)
- Built-in column menu items: Sort Ascending, Sort Descending, AutoFit, AutoFit All, Column Chooser, Filter
- Disable column menu per column — GanttColumn.ShowColumnMenu="false"
- Column chooser — ShowColumnChooser + "ColumnChooser" toolbar item
📄 Read: references/column-validation-and-editing.md
- Enable editing — GanttEditSettings, IsPrimaryKey on key column
- Inline ValidationRules — Required, RangeLength, Range, Number, Min, Max, Messages dictionary
- Data annotation validation — [Required], [StringLength], [Range] on model class
- Custom validation attribute — inherit ValidationAttribute, override IsValid()
- Custom validator component — GanttEditSettings.Validator + ValidatorTemplateContext + ShowValidationMessage + IDisposable
- Per-column EditType — DefaultEdit, NumericEdit, DatePickerEdit, DateTimePickerEdit, BooleanEdit, DropDownEdit
- Note: validation not supported for Resource column
---
9. Rows and Selection
When to read: Row operations, cell/row selection modes
📄 Read: references/rows-and-height.md
- RowHeight configuration
- AutoFitRows feature
- Row template customization
- Row-level styling
📄 Read: references/selection-modes.md
- SelectionSettings (Mode, Type, CellSelectionMode)
- Row selection (Single/Multiple)
- Cell selection (Box/Flow/BoxWithBorder)
- Programmatic selection APIs (SelectRow, SelectCell)
---
10. Interactions
When to read: User interactions, filtering, sorting, searching
📄 Read: references/filtering-and-search.md
- FilterSettings (Type: Menu, Excel)
- FilterHierarchyMode (Parent, Child, Both, None)
- Search functionality (SearchSettings)
- Column-level filtering
📄 Read: references/sorting-operations.md
- AllowSorting configuration
- Single and multi-column sorting
- SortSettings (Columns collection)
- Programmatic sorting APIs
📄 Read: references/context-menu-and-toolbar.md
- Toolbar built-in items (18 items) and custom items with Align support
- Mixed built-in + custom toolbar using List\<Object\>
- Enable/disable toolbar items dynamically via EnableItems method
- Context menu — EnableContextMenu, built-in items, custom items, sub-menus
- Disable context menu for specific columns via ContextMenuOpen event
- ContextMenuItemClicked event for custom item handling
📄 Read: references/touch-and-interaction-modes.md
- Touch interaction support
- EnableTouch property
- Splitter for resizing grid/chart panes
- SplitterSettings configuration
📄 Read: references/clipboard-and-accessibility.md
- Copy/paste functionality
- Clipboard module integration
- Keyboard navigation
- Accessibility features
---
11. Performance
When to read: Optimization strategies, large datasets
📄 Read: references/virtualization-and-performance.md
- EnableRowVirtualization for large datasets
- Row and column virtualization
- Frozen columns (FrozenColumns property)
- WebAssembly performance optimization tips
- Best practices for handling 10,000+ tasks
---
12. Export
When to read: PDF and Excel export features
📄 Read: references/pdf-export.md
- PdfExport() method
- PdfExportProperties configuration
- Multi-page PDF export
- Header and footer customization
- Page size and styling in PDF
- Template-based PDF export
📄 Read: references/excel-export.md
- ExcelExport() method
- ExcelExportProperties configuration
- Column formatting in Excel
- Hierarchical data export
- Custom cell styling
---
13. API Reference
When to read: Detailed API documentation lookup
📄 Read: references/gantt-methods-properties.md
- SfGantt<TValue> main component
- GanttTaskFields mapping
- GanttColumn configuration
- GanttResource properties
- GanttSegment for task splitting
📄 Read: references/api-settings-classes.md
- GanttEditSettings (AllowAdding, AllowEditing, AllowDeleting, Mode)
- GanttSelectionSettings (Mode, Type, CellSelectionMode)
- GanttFilterSettings (Type, HierarchyMode)
- GanttSortSettings and GanttSearchSettings
- GanttTimelineSettings and GanttSplitterSettings
📄 Read: references/api-event-args.md
- GanttActionEventArgs<TValue>
- BeforeTooltipRenderEventArgs<TValue>
- BeforeCopyEventArgs
- Other event argument classes
📄 Read: references/api-enums-and-types.md
- EditMode (Auto, Dialog, Taskbar)
- DependencyType (FS, SF, FF, SS)
- DurationUnit (Day, Hour, Minute)
- FilterType, ViewType, GridLine enums
- Other enum types
---
Quick Start Example
@page "/gantt"
@using Syncfusion.Blazor.Gantt
<SfGantt DataSource="@TaskCollection" Height="450px" Width="100%">
<GanttTaskFields Id="TaskId"
Name="TaskName"
StartDate="StartDate"
EndDate="EndDate"
Duration="Duration"
Progress="Progress"
ParentID="ParentId"
Dependency="Predecessor">
</GanttTaskFields>
</SfGantt>
@code {
private List<TaskData> TaskCollection { get; set; }
protected override void OnInitialized()
{
TaskCollection = new List<TaskData>
{
new TaskData { TaskId = 1, TaskName = "Project Initiation", StartDate = new DateTime(2024, 04, 01), EndDate = new DateTime(2024, 04, 05), Progress = 100 },
new TaskData { TaskId = 2, TaskName = "Identify Site location", StartDate = new DateTime(2024, 04, 01), Duration = 4, Progress = 50, ParentId = 1 },
new TaskData { TaskId = 3, TaskName = "Perform Soil test", StartDate = new DateTime(2024, 04, 01), Duration = 3, Progress = 70, Predecessor = "2", ParentId = 1 },
};
}
public class TaskData
{
public int TaskId { get; set; }
public string TaskName { get; set; }
public DateTime StartDate { get; set; }
public DateTime? EndDate { get; set; }
public int? Duration { get; set; }
public int Progress { get; set; }
public int? ParentId { get; set; }
public string Predecessor { get; set; }
}
}---
Common Patterns
Pattern 1: Full CRUD with Dialog Editing
<SfGantt DataSource="@TaskCollection" Toolbar="@ToolbarItems">
<GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate"
EndDate="EndDate" Duration="Duration" Progress="Progress"
ParentID="ParentId" Dependency="Predecessor">
</GanttTaskFields>
<GanttEditSettings AllowAdding="true"
AllowEditing="true"
AllowDeleting="true"
AllowTaskbarEditing="true"
Mode="EditMode.Dialog">
</GanttEditSettings>
</SfGantt>
@code {
private List<string> ToolbarItems = new List<string> { "Add", "Edit", "Delete" };
}Pattern 2: Critical Path with Resource Allocation
<SfGantt DataSource="@TaskCollection"
Resources="@ResourceCollection"
EnableCriticalPath="true">
<GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate"
EndDate="EndDate" Duration="Duration"
ResourceInfo="Resources" Work="Work">
</GanttTaskFields>
<GanttResource DataSource="@ResourceCollection"
Id="ResourceId"
Name="ResourceName">
</GanttResource>
<GanttCriticalPathSettings SlackValue="1"></GanttCriticalPathSettings>
</SfGantt>Pattern 3: Remote Data with Entity Framework
<SfGantt TValue="TaskData">
<SfDataManager Adaptor="Adaptors.UrlAdaptor" Url="api/gantt"></SfDataManager>
<GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate"
EndDate="EndDate" Duration="Duration" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>Pattern 4: Export with Custom Styling
<SfGantt @ref="GanttRef"
DataSource="@TaskCollection"
AllowPdfExport="true"
AllowExcelExport="true"
Toolbar="@ToolbarItems">
<GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate">
</GanttTaskFields>
<GanttEvents TValue="TaskData" OnToolbarClick="ToolbarClickHandler"></GanttEvents>
</SfGantt>
@code {
private SfGantt<TaskData> GanttRef;
private List<string> ToolbarItems = new List<string> { "PdfExport", "ExcelExport" };
private async Task ToolbarClickHandler(ClickEventArgs args)
{
if (args.Item.Id == "PdfExport")
await GanttRef.ExportToPdfAsync();
else if (args.Item.Id == "ExcelExport")
await GanttRef.ExportToExcelAsync();
}
}---
Key Configuration Points
Essential Properties
- DataSource: Task collection (hierarchical or self-referential)
- GanttTaskFields: Maps task properties (Id, Name, StartDate, Duration, ParentID, Dependency)
- Height/Width: Component dimensions
- Toolbar: Built-in actions (Add, Edit, Delete, Search, Export)
- GanttEditSettings: CRUD permissions and edit mode
Timeline Configuration
- DurationUnit: Default duration unit (Day, Hour, Minute)
- ProjectStartDate/ProjectEndDate: Timeline boundaries
- GanttTimelineSettings: Timeline tiers, format, zoom levels
- DayWorkingTime: Working hours per day
- Holidays: Non-working dates
Visual Customization
- GanttTaskbarSettings: Taskbar height and styling
- GanttLabelSettings: Left, right, top labels
- GanttTemplates: Custom taskbar, tooltip, milestone templates
- BaselineColor/ConnectorLineBackground: Visual styling
Performance Optimization
- EnableRowVirtualization: For large datasets (1000+ tasks)
- EnableColumnVirtualization: For many columns
- LoadChildOnDemand: Lazy-load child tasks
- TreeColumnIndex: Specify hierarchy column
---
Common Use Cases
1. Project Management Dashboard: Full CRUD, dependencies, critical path, resource allocation 2. Construction Scheduling: Baseline tracking, split tasks, holidays, custom working hours 3. Resource Planning: Resource view, overallocation detection, work-based scheduling 4. Sprint Planning: Timeline zooming, milestone tracking, progress indicators 5. Manufacturing Timeline: Multi-level hierarchy, dependency validation, PDF export
---
Next Steps
After reviewing this navigation guide:
1. For initial setup: Start with section 1 (Getting Started) based on your platform 2. For data connectivity: Review section 2 (Data Binding) for your data source type 3. For specific features: Navigate to the relevant section and read focused reference files 4. For API details: Consult section 13 (API Reference) for properties, methods, and classes
Events reference: Event argument types are documented inreferences/api-event-args.md. Individual feature files (e.g.,taskbar-editing.md,filtering-and-search.md,sorting-operations.md,selection-modes.md) each document the events specific to that feature with handler signatures and examples.
Each reference file provides complete implementation details, code examples, edge cases, and troubleshooting guidance for its specific topic.
API Enums and Types — Complete Reference
Comprehensive reference for all enums and types used in the Syncfusion Blazor Gantt Chart API.
Table of Contents
---
Scheduling
ScheduleMode
Controls how task schedules are calculated and validated.
Values:
- `Auto` — System automatically calculates task dates based on dependencies and constraints
- `Manual` — User has full control over task dates; system doesn't auto-calculate
- `Custom` — Mix of auto and manual; each task can specify its own mode via
Manualfield
Usage:
<SfGantt TaskMode="ScheduleMode.Auto">
<GanttTaskFields Manual="Manual"></GanttTaskFields>
</SfGantt>When to Use:
Auto: Standard project management with automatic schedulingManual: Full user control, ignore dependencies for scheduleCustom: Per-task scheduling mode control
---
DurationUnit
Specifies the unit of measurement for task duration.
Values:
- `Minute` — Duration measured in minutes
- `Hour` — Duration measured in hours
- `Day` — Duration measured in days (default)
- `Week` — Duration measured in weeks
- `Month` — Duration measured in months
- `Year` — Duration measured in years
Usage:
<SfGantt DurationUnit="DurationUnit.Day" DataSource="@Tasks">
</SfGantt>Notes:
- Duration field values must match the unit (e.g., "5" = 5 days if
DurationUnit.Day) - Working hours and holidays affect actual calendar time for Day/Week/Month units
---
DependencyType
Defines task dependency relationships.
Values:
- `FS` — Finish-to-Start: Successor starts when predecessor finishes
- `SS` — Start-to-Start: Both tasks start simultaneously
- `FF` — Finish-to-Finish: Both tasks finish simultaneously
- `SF` — Start-to-Finish: Successor finishes when predecessor starts
Usage:
<SfGantt EnablePredecessorValidation="true"
DependencyTypes="@(new List<DependencyType>() { DependencyType.FS, DependencyType.SS })">
</SfGantt>
// In task data: Predecessor = "3FS+2" (Task 3, Finish-to-Start, 2-day lag)When to Use:
FS: Most common; task B starts after task A finishesSS: Tasks must start together (e.g., parallel workflows)FF: Tasks must finish together (e.g., coordinated deliverables)SF: Rare; used in just-in-time scenarios
---
Task Management
TaskType
Determines which task field remains constant during work calculations.
Values:
- `FixedUnit` — Resource units remain constant; duration/work adjust (default)
- `FixedDuration` — Duration remains constant; work/units adjust
- `FixedWork` — Work remains constant; duration/units adjust
Usage:
<SfGantt TaskType="TaskType.FixedUnit">
<GanttTaskFields Work="Work"></GanttTaskFields>
</SfGantt>
// Or per-task:
public class TaskData {
public TaskType TaskType { get; set; }
}Calculation Formulas:
- Work = Duration × Units
- When
FixedUnit: Changing Duration recalculates Work - When
FixedDuration: Changing Units recalculates Work - When
FixedWork: Changing Duration recalculates Units
Example:
// FixedUnit: 5 days × 2 units = 10 days work
// Change duration to 10 days → 10 days × 2 units = 20 days work
// FixedWork: 10 days work with 2 units = 5 days duration
// Change to 1 unit → 10 days work ÷ 1 unit = 10 days duration
// FixedDuration: 5 days with 10 days work = 2 units
// Change work to 20 days → 20 days ÷ 5 days = 4 units---
WorkUnit
Specifies the unit for work effort tracking.
Values:
- `Hour` — Work measured in hours
- `Day` — Work measured in days
- `Minute` — Work measured in minutes
Usage:
<SfGantt WorkUnit="WorkUnit.Hour">
<GanttTaskFields Work="Work"></GanttTaskFields>
</SfGantt>Notes:
- Work field values stored as numbers (e.g., 40 = 40 hours)
- Affects work-based calculations with resource assignments
---
RowPosition
Specifies where to add new tasks relative to existing rows.
Values:
- `Top` — Add as first row in the grid
- `Bottom` — Add as last row in the grid
- `Above` — Add above the specified row index
- `Below` — Add below the specified row index
- `Child` — Add as child of the specified row
Usage:
TaskData newTask = new TaskData() { TaskId = 100, TaskName = "New Task" };
await Gantt.AddRecordAsync(newTask, 5, RowPosition.Below);When to Use:
Top/Bottom: Adding root-level tasks without specific positionAbove/Below: Inserting tasks at specific positionsChild: Creating subtasks under parent tasks
---
Grid & UI
EditMode
Controls how users edit tasks.
Values:
- `Auto` — Both grid and taskbar editing enabled
- `Dialog` — Edit only via dialog (double-click or edit button)
- `Taskbar` — Edit only via taskbar drag/resize
Usage:
<SfGantt>
<GanttEditSettings Mode="EditMode.Auto" AllowEditing="true"></GanttEditSettings>
</SfGantt>When to Use:
Auto: Full editing flexibility (recommended)Dialog: Enforce structured data entry, prevent accidental changesTaskbar: Quick visual adjustments only
---
SelectionMode
Defines what can be selected in the grid.
Values:
- `Row` — Select entire rows only
- `Cell` — Select individual cells only
- `Both` — Select either rows or cells
Usage:
<SfGantt AllowSelection="true">
<GanttSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Multiple">
</GanttSelectionSettings>
</SfGantt>---
SelectionType
Controls single vs multiple selection.
Values:
- `Single` — Select one row/cell at a time
- `Multiple` — Select multiple rows/cells (Ctrl+Click, Shift+Click)
Usage:
<GanttSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Multiple">
</GanttSelectionSettings>---
CellSelectionMode
Defines cell selection behavior (when SelectionMode="Cell").
Values:
- `Flow` — Cells selected flowing like text (left-to-right, wrap to next row)
- `Box` — Rectangular selection area
- `BoxWithBorder` — Rectangular selection with border highlight
Usage:
<GanttSelectionSettings Mode="SelectionMode.Cell"
CellSelectionMode="CellSelectionMode.Box">
</GanttSelectionSettings>---
GridLine
Controls grid cell border visibility.
Values:
- `None` — No grid lines
- `Horizontal` — Horizontal lines only (default)
- `Vertical` — Vertical lines only
- `Both` — Both horizontal and vertical lines
Usage:
<SfGantt GridLines="GridLine.Both">
</SfGantt>---
SplitterView
Defines splitter position between grid and chart.
Values:
- `Default` — Use configured splitter position
- `Grid` — Show only grid section (chart hidden)
- `Chart` — Show only chart section (grid hidden)
Usage:
await Gantt.SetSplitterPositionAsync(SplitterView.Grid);
await Gantt.SetSplitterPositionAsync(SplitterView.Chart);
await Gantt.SetSplitterPositionAsync(SplitterView.Default);When to Use:
Grid: Focus on data entry and reviewChart: Focus on visual timeline and dependenciesDefault: Balanced view
---
Data Operations
SortDirection
Specifies sort order.
Values:
- `Ascending` — Sort A→Z, 0→9, oldest→newest
- `Descending` — Sort Z→A, 9→0, newest→oldest
Usage:
await Gantt.SortByColumnAsync("TaskName", SortDirection.Ascending, false);
// Or declaratively:
<GanttSortSettings>
<GanttSortColumns>
<GanttSortColumn Field="TaskId" Direction="SortDirection.Descending"></GanttSortColumn>
</GanttSortColumns>
</GanttSortSettings>---
FilterType
Controls filter UI style.
Values:
- `Menu` — Traditional filter menu with operators (default)
- `Excel` — Excel-style checkbox filter with search
- `FilterBar` — Filter row below headers
- `CheckBox` — Checkbox list filter
Usage:
<SfGantt AllowFiltering="true">
<GanttFilterSettings Type="FilterType.Excel"></GanttFilterSettings>
</SfGantt>When to Use:
Menu: Advanced filtering with operators (contains, equals, etc.)Excel: Quick multi-value selectionFilterBar: Immediate type-ahead filtering
---
FilterHierarchyMode
Controls hierarchical data filtering behavior.
Values:
- `Parent` — Show parent rows if they match filter
- `Child` — Show child rows if they match filter
- `Both` — Show both parents and children if either matches
- `None` — Show only exact matches (ignore hierarchy)
Usage:
<GanttFilterSettings HierarchyMode="FilterHierarchyMode.Both">
</GanttFilterSettings>Example:
- Filter: "Design" with
Both→ Shows parent "Project" + child "Design Phase" - Filter: "Design" with
None→ Shows only "Design Phase"
---
View & Display
ViewType
Switches between project and resource views.
Values:
- `ProjectView` — Standard task-centric view (default)
- `ResourceView` — Resource-centric view with tasks grouped by resource
Usage:
<SfGantt ViewType="ViewType.ResourceView">
<GanttResource DataSource="@Resources" TResources="ResourceModel"></GanttResource>
<GanttAssignmentFields DataSource="@Assignments"></GanttAssignmentFields>
</SfGantt>When to Use:
ProjectView: Manage tasks and timelineResourceView: Manage resource allocation and workload
---
TimelineViewMode
Defines timeline scale granularity.
Values:
- `None` — No timeline
- `Hour` — Hourly timeline
- `Day` — Daily timeline (default)
- `Week` — Weekly timeline
- `Month` — Monthly timeline
- `Year` — Yearly timeline
Usage:
<GanttTimelineSettings TimelineViewMode="TimelineViewMode.Week">
</GanttTimelineSettings>Auto-Zoom: Timeline automatically adjusts based on project duration, but can be locked with TimelineViewMode.
---
Common Enum Usage Patterns
Multiple Enums in Configuration
<SfGantt DataSource="@Tasks"
TaskMode="ScheduleMode.Auto"
TaskType="TaskType.FixedUnit"
DurationUnit="DurationUnit.Day"
GridLines="GridLine.Both"
AllowFiltering="true"
AllowSelection="true">
<GanttTaskFields TaskType="TaskType" Manual="IsManual"></GanttTaskFields>
<GanttEditSettings Mode="EditMode.Auto" AllowEditing="true"></GanttEditSettings>
<GanttSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Multiple">
</GanttSelectionSettings>
<GanttFilterSettings Type="FilterType.Excel" HierarchyMode="FilterHierarchyMode.Both">
</GanttFilterSettings>
</SfGantt>Programmatic Enum Usage
// Add task with position
await Gantt.AddRecordAsync(newTask, index, RowPosition.Below);
// Set splitter view
await Gantt.SetSplitterPositionAsync(SplitterView.Chart);
// Sort data
await Gantt.SortByColumnAsync("TaskName", SortDirection.Ascending, true);
// Add dependency
Gantt.AddPredecessor(12, "4FS+2"); // Task 4, Finish-to-Start, 2-day lag---
Type Aliases & Interfaces
Key Types
- `TValue` — Generic type for task data model
- `TResources` — Generic type for resource data model
- `TAssignment` — Generic type for resource assignment data model
- `TSegments` — Generic type for task segment data model
Usage:
<SfGantt TValue="TaskData" DataSource="@Tasks">
<GanttResource TResources="ResourceModel" DataSource="@Resources">
</GanttResource>
<GanttAssignmentFields TAssignment="AssignmentModel" DataSource="@Assignments">
</GanttAssignmentFields>
</SfGantt>---
Cross-References
- Related References:
---
API — Event Argument Classes Reference
Table of Contents
- Core Action Events
- Row CRUD Events
- Taskbar Editing Events
- Dialog Events
- Dependency Events
- Segment Events
- Tooltip Events
- Clipboard Events
- PDF Export Events
- Undo/Redo Events
- Zoom Events
- Resource Allocation Events
- Context Menu Events
- Usage Notes
- Related References
--- Comprehensive reference for Gantt event argument types. These classes provide data and control for various Gantt component events. Most support cancellation via a Cancel property.
---
Core Action Events
GanttActionEventArgs<TValue>
Primary event argument for action lifecycle events (OnActionBegin, OnActionComplete, OnActionFailure).
Key Properties:
- `RequestType` (
Action) - Current action: Add, Edit, Delete, Save, Refresh, Sorting, Filtering, Searching, etc. - `Data` (
TValue) - Record object(s) involved in the action - `PreviousData` (
TValue) - Previous state before action - `Cancel` (
bool) - Set true to cancel the action. Default: false - `Action` (
string) - String representation of current action - `RowData` (
TValue) - Record object for row operations - `RowIndex` (
int) - Index of edited/affected row - `ModifiedTaskData` (
List<TValue>) - Collection of modified tasks - `EditContext` (
EditContext) - Form edit context - `TaskBarEditAction` (
string) - Type of taskbar edit (resize, drag, progress) - `Direction` (
SortDirection) - Sort direction (Ascending/Descending) - `Columns` (
List<PredicateModel<object>>) - Filter column collection - `CurrentFilterObject` (
PredicateModel<object>) - Currently filtered object - `SearchString` (
string) - Search keyword - `ValidateMode` (
ValidateMode) - Validation mode for predecessors - `EnableAutoLinkValidation` (
bool) - Enable predecessor validation on draw. Default: true - `PredecessorOffSetValidation` (
bool) - Restrict taskbar drag beyond predecessor. Default: false - `CurrentZoomingLevel` (
GanttZoomTimelineSettings) - Current zoom level
Example:
<SfGantt DataSource="@TaskCollection">
<GanttEvents OnActionBegin="ActionBeginHandler"
OnActionComplete="ActionCompleteHandler"
TValue="TaskData">
</GanttEvents>
</SfGantt>
@code {
private void ActionBeginHandler(GanttActionEventArgs<TaskData> args)
{
if (args.RequestType == Syncfusion.Blazor.Gantt.Action.BeforeSave)
{
// Validate before saving
if (args.Data.Duration <= 0)
{
args.Cancel = true;
// Show error message
}
}
}
private void ActionCompleteHandler(GanttActionEventArgs<TaskData> args)
{
if (args.RequestType == Syncfusion.Blazor.Gantt.Action.Save)
{
Console.WriteLine($"Task saved: {args.Data.TaskName}");
}
}
}---
Row CRUD Events
GanttRowUpdatingEventArgs<T>
Fired before a row is updated.
Properties:
- `Cancel` (
bool) - Cancel the update - `Data` (
T) - Updated data object - `PreviousData` (
T) - Previous data state - `Index` (
int) - Row index - `Action` (
string) - Action type - `PrimaryKeyValue` (
object) - Primary key value - `IsShiftKeyPressed` (
bool) - Whether Shift key was pressed - `KeyCode` (
int) - Key code if keyboard action
GanttRowUpdatedEventArgs<T>
Fired after a row is updated successfully.
Properties: Same as GanttRowUpdatingEventArgs<T> (but read-only, no Cancel)
GanttRowDeletingEventArgs<T> / GanttRowDeletedEventArgs<T>
Similar structure for delete operations (RowDeleting fires before, RowDeleted fires after).
GanttRowCreatingEventArgs<T> / GanttRowCreatedEventArgs<T>
Similar structure for row creation operations.
Example:
<SfGantt DataSource="@TaskCollection">
<GanttEvents RowUpdating="RowUpdatingHandler"
RowUpdated="RowUpdatedHandler"
TValue="TaskData">
</GanttEvents>
</SfGantt>
@code {
private void RowUpdatingHandler(GanttRowUpdatingEventArgs<TaskData> args)
{
// Validate before update
if (args.Data.EndDate < args.Data.StartDate)
{
args.Cancel = true;
}
}
private void RowUpdatedHandler(GanttRowUpdatedEventArgs<TaskData> args)
{
Console.WriteLine($"Row {args.Index} updated successfully");
}
}---
Taskbar Editing Events
TaskbarEditingEventArgs<T>
Fired before taskbar editing begins.
Properties:
- `Cancel` (
bool) - Cancel the taskbar edit - `Data` (
T) - Task data - `RecordIndex` (
int) - Task index - `TaskBarEditAction` (
string) - Edit action type (LeftResizing, RightResizing, ProgressResizing, ChildDrag, ConnectorPointLeftDrag, etc.) - `RoundOffDuration` (
bool) - Whether to round off duration
TaskbarEditedEventArgs<T>
Fired after taskbar editing completes.
Properties:
- `Action` (
string) - Action type - `Data` (
T) - Updated task data - `PreviousData` (
T) - Previous task state - `RecordIndex` (
int) - Task index - `TaskBarEditAction` (
string) - Edit action type - `ColumnName` (
string) - Edited column name - `EditingFields` (
GanttTaskModel) - Editable field model - `RoundOffDuration` (
bool) - Duration rounding flag
Example:
<SfGantt DataSource="@TaskCollection">
<GanttEditSettings AllowTaskbarEditing="true"></GanttEditSettings>
<GanttEvents TaskbarEditing="TaskbarEditingHandler"
TaskbarEdited="TaskbarEditedHandler"
TValue="TaskData">
</GanttEvents>
</SfGantt>
@code {
private void TaskbarEditingHandler(TaskbarEditingEventArgs<TaskData> args)
{
Console.WriteLine($"Editing taskbar: {args.TaskBarEditAction}");
// Optionally cancel specific actions
if (args.TaskBarEditAction == "ProgressResizing")
{
// args.Cancel = true;
}
}
private void TaskbarEditedHandler(TaskbarEditedEventArgs<TaskData> args)
{
Console.WriteLine($"Taskbar edited. New duration: {args.EditingFields.Duration}");
}
}---
Dialog Events
GanttDialogOpenEventArgs<TValue>
Fired before a dialog (Add/Edit) opens.
Properties:
- `Cancel` (
bool) - Cancel dialog opening - `Data` (
TValue) - Row data being edited - `IsEditAction` (
bool) - True if edit dialog, false if add dialog
GanttDialogOpenedEventArgs<TValue>
Fired after dialog is opened.
Properties:
- `Data` (
TValue) - Row data - `EditType` (
DialogType) - Dialog type (Add/Edit)
GanttDialogCloseEventArgs<TValue>
Fired before dialog closes.
Properties:
- `Cancel` (
bool) - Cancel dialog close - `Data` (
TValue) - Row data - `RequestType` (
string) - Close action type (Save/Cancel)
Example:
<SfGantt DataSource="@TaskCollection">
<GanttEvents DialogOpening="DialogOpeningHandler"
DialogOpened="DialogOpenedHandler"
DialogClosing="DialogClosingHandler"
TValue="TaskData">
</GanttEvents>
</SfGantt>
@code {
private void DialogOpeningHandler(GanttDialogOpenEventArgs<TaskData> args)
{
if (args.IsEditAction)
{
Console.WriteLine($"Editing task: {args.Data.TaskName}");
}
else
{
Console.WriteLine("Adding new task");
}
}
private void DialogClosingHandler(GanttDialogCloseEventArgs<TaskData> args)
{
if (args.RequestType == "save")
{
// Custom validation
if (string.IsNullOrEmpty(args.Data.TaskName))
{
args.Cancel = true;
}
}
}
}---
Dependency Events
TaskConnectorChangeEventArgs<T>
Fired before a dependency (predecessor) changes.
Properties:
- `Cancel` (
bool) - Cancel the dependency change - `Data` (
T) - Task data - `PredecessorString` (
string) - New predecessor string - `Type` (
DependencyType) - Dependency type (FS, SS, FF, SF)
TaskConnectorChangedEventArgs<T>
Fired after dependency changes.
Properties: Similar to TaskConnectorChangeEventArgs<T> (read-only)
---
Segment Events
SegmentEventArgs<T>
Used for split task segment operations.
Properties:
- `Cancel` (
bool) - Cancel segment operation - `Data` (
T) - Task data - `SegmentData` (
GanttSegmentData) - Segment information
---
Tooltip Events
BeforeTooltipRenderEventArgs<TValue>
Fired before a tooltip renders, allowing customization.
Properties:
- `Cancel` (
bool) - Cancel tooltip display - `Content` (
RenderFragment) - Custom tooltip content - `Data` (
TValue) - Task data for the tooltip - `Target` (
string) - Target element
Example:
<SfGantt DataSource="@TaskCollection">
<GanttEvents BeforeTooltipRender="BeforeTooltipRenderHandler" TValue="TaskData">
</GanttEvents>
</SfGantt>
@code {
private void BeforeTooltipRenderHandler(BeforeTooltipRenderEventArgs<TaskData> args)
{
// Customize or cancel tooltip
if (args.Data.Progress < 50)
{
args.Content = @<div style="color:red;">Behind schedule!</div>;
}
}
}---
Clipboard Events
BeforeCopyEventArgs
Fired before clipboard copy operation.
Properties:
- `Cancel` (
bool) - Cancel copy operation - `ClipboardText` (
string) - Text being copied to clipboard (can modify)
Example:
<SfGantt DataSource="@TaskCollection">
<GanttEvents BeforeCopy="BeforeCopyHandler" TValue="TaskData">
</GanttEvents>
</SfGantt>
@code {
private void BeforeCopyHandler(BeforeCopyEventArgs args)
{
Console.WriteLine($"Copying: {args.ClipboardText}");
// Optionally modify clipboard content
args.ClipboardText = "Custom: " + args.ClipboardText;
}
}---
PDF Export Events
PdfExportEventArgs
Fired before PDF export begins.
Properties:
- `Cancel` (
bool) - Cancel export - `PdfExportProperties` (
GanttPdfExportProperties) - Export configuration - `IsMultipleExport` (
bool) - Whether exporting multiple grids
PdfExportedEventArgs
Fired after PDF export completes.
Properties:
- `PdfDocument` - Exported PDF document object
PdfQueryCellInfoEventArgs<TValue>
Fired for each cell during PDF export, allowing customization.
Properties:
- `Cell` (
PdfGanttCell) - Cell being exported - `Data` (
TValue) - Row data - `Column` - Column definition
PdfQueryTaskbarInfoEventArgs<TValue>
Fired for each taskbar during PDF export.
Properties:
- `Taskbar` (
PdfTaskbar) - Taskbar being exported - `Data` (
TValue) - Task data - `TaskbarColor` (
PdfTaskbarColor) - Taskbar colors
Example:
<SfGantt DataSource="@TaskCollection" AllowPdfExport="true">
<GanttEvents PdfExport="PdfExportHandler"
PdfQueryCellInfo="PdfQueryCellHandler"
TValue="TaskData">
</GanttEvents>
</SfGantt>
@code {
private void PdfExportHandler(PdfExportEventArgs args)
{
args.PdfExportProperties.FileName = "ProjectGantt_" + DateTime.Now.ToString("yyyyMMdd");
}
private void PdfQueryCellHandler(PdfQueryCellInfoEventArgs<TaskData> args)
{
if (args.Column.Field == "Duration" && args.Data.Duration > 10)
{
args.Cell.Style.BackgroundColor = new PdfColor(255, 200, 200);
}
}
}---
Undo/Redo Events
GanttUndoRedoEventArgs<TValue>
Fired for undo/redo operations.
Properties:
- `Cancel` (
bool) - Cancel undo/redo - `Action` (
GanttUndoRedoAction) - Action being undone/redone - `Data` (
TValue) - Affected data - `RequestType` (
string) - "undo" or "redo"
---
Zoom Events
ZoomEventArgs
Fired before zooming action.
Properties:
- `Cancel` (
bool) - Cancel zoom - `PreviousZoomingLevel` (
GanttZoomTimelineSettings) - Previous zoom level - `RequestType` (
ZoomAction) - Zoom action (ZoomIn/ZoomOut/ZoomToFit)
ZoomedEventArgs
Fired after zooming completes.
Properties:
- `CurrentZoomingLevel` (
GanttZoomTimelineSettings) - Current zoom level - `PreviousZoomingLevel` (
GanttZoomTimelineSettings) - Previous zoom level
---
Resource Allocation Events
ResourceAssignmentChangeEventArgs<TValue>
Fired when resource assignments change.
Properties:
- `Cancel` (
bool) - Cancel assignment change - `Data` (
TValue) - Task data - `ResourceData` - Resource information
---
Context Menu Events
ContextMenuClickEventArgs<TValue>
Fired when context menu item is clicked.
Properties:
- `Item` (
ContextMenuItemModel) - Clicked menu item - `RowData` (
TValue) - Row data where menu was invoked
ContextMenuOpenEventArgs<TValue>
Fired before context menu opens.
Properties:
- `Cancel` (
bool) - Cancel menu opening - `RowData` (
TValue) - Row data - `Items` - Menu items collection (can modify)
---
Usage Notes
1. Cancellation Pattern: Most "...ing" events (before action) support Cancel = true to prevent the action.
2. Strongly-Typed Data: Use generic TValue parameter matching your data model:
<GanttEvents TValue="TaskData">3. Event Order: Typical sequence:
OnActionBegin-[Specific event like RowUpdating]- Action executes -[Specific event like RowUpdated]-OnActionComplete
4. EditContext: Available in GanttActionEventArgs for form validation scenarios.
5. Async Events: Most event handlers can be async:
private async Task ActionBeginHandler(GanttActionEventArgs<TaskData> args)
{
await ValidateAsync(args.Data);
}API — Settings Classes Reference
Table of Contents
- GanttEditSettings
- GanttSelectionSettings
- GanttFilterSettings
- GanttSortSettings
- GanttSearchSettings
- GanttTimelineSettings
- GanttTimelineTierSettings
- GanttSplitterSettings
- GanttTooltipSettings
- GanttLabelSettings
- GanttTaskbarSettings
- GanttCriticalPathSettings
- GanttKeySettings
- GanttColumnChooserSettings
- Export Settings Classes
- Usage Notes
- Related References
--- Comprehensive reference for Gantt configuration classes. Each settings class controls specific aspects of the Gantt component behavior. These are typically declared as child components within <SfGantt>.
---
GanttEditSettings
Configures CRUD operations and editing behavior.
Properties
- `AllowAdding` (
bool) — Enable adding new records. Default: false - `AllowEditing` (
bool) — Enable editing existing records. Default: false - `AllowDeleting` (
bool) — Enable deleting records. Default: false - `AllowTaskbarEditing` (
bool) — Enable taskbar resizing, dragging, progress resizing, and predecessor drawing. Default: false - `AllowSchedulingOnDrag` (
bool) — Allow click-and-drag on chart to schedule dates. Default: false - `Mode` (
EditMode) — Edit mode (Auto/Dialog). Auto = cell edit in grid, dialog in chart. Default: Auto - `NewRowPosition` (
RowPosition) — Where to add new records (Top/Bottom/Above/Below/Child). Default: Top - `ShowDeleteConfirmDialog` (
bool) — Show confirmation before deleting. Default: false - `Validator` (
RenderFragment<object>?) — Custom validation component for edit form. Default: null
Example
<SfGantt DataSource="@TaskCollection" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })">
<GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate"
EndDate="EndDate" Duration="Duration" ParentID="ParentId">
</GanttTaskFields>
<GanttEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"
AllowTaskbarEditing="true" ShowDeleteConfirmDialog="true">
</GanttEditSettings>
</SfGantt>---
GanttSelectionSettings
Configures row and cell selection behavior.
Properties
- `Mode` (
SelectionMode) — Selection mode (Row/Cell/Both). Default: Row - `Type` (
SelectionType) — Selection type (Single/Multiple). Default: Single - `CellSelectionMode` (
CellSelectionMode) — Cell selection mode (Flow/Box/BoxWithBorder). Default: Flow - `EnableToggle` (
bool) — Allow toggling selection by clicking selected row. Default: false - `PersistSelection` (
bool) — Persist selection across operations (sort/filter). Default: false - `AllowDragSelection` (
bool) — Enable drag-to-select multiple rows/cells. Default: false
Example
<SfGantt DataSource="@TaskCollection">
<GanttSelectionSettings Mode="SelectionMode.Both"
Type="SelectionType.Multiple"
EnableToggle="true"
AllowDragSelection="true">
</GanttSelectionSettings>
</SfGantt>---
GanttFilterSettings
Configures filtering behavior.
Properties
- `FilterType` (
FilterType) — Filter UI type (Menu/Excel). Default: Menu Menu: Standard filter menuExcel: Advanced filter with checkboxes, search, and custom templates- `HierarchyMode` (
FilterHierarchyMode) — How to filter hierarchical data: Parent: Show filtered record with parentChild: Show filtered record with childrenBoth: Show with both parent and childrenNone: Show only filtered record (default)- `Columns` (
List<PredicateModel>) — Initial filter column definitions - `IgnoreAccent` (
bool) — Ignore diacritic characters/accents. Default: false - `Operators` (
object) — Custom filter operators by data type
Example
<SfGantt DataSource="@TaskCollection" AllowFiltering="true">
<GanttFilterSettings FilterType="FilterType.Excel"
HierarchyMode="FilterHierarchyMode.Parent">
</GanttFilterSettings>
</SfGantt>---
GanttSortSettings
Configures sorting behavior.
Properties
- `Columns` (
List<GanttSortDescriptor>) — Initial sort columns and directions - `AllowUnsort` (
bool) — Allow unsort by clicking sorted column header. Default: true
Example
<SfGantt DataSource="@TaskCollection" AllowSorting="true" AllowMultiSorting="true">
<GanttSortSettings AllowUnsort="true">
<GanttSortDescriptors>
<GanttSortDescriptor Field="TaskId" Direction="SortDirection.Descending"></GanttSortDescriptor>
<GanttSortDescriptor Field="TaskName" Direction="SortDirection.Ascending"></GanttSortDescriptor>
</GanttSortDescriptors>
</GanttSortSettings>
</SfGantt>---
GanttSearchSettings
Configures search behavior.
Properties
- `Fields` (
string[]) — Columns to search. Default: all columns - `Key` (
string) — Search keyword. Default: empty - `Operator` (
Operator) — Search operator (Contains/Equals/StartsWith/EndsWith). Default: Contains - `HierarchyMode` (
FilterHierarchyMode) — Search mode for hierarchical data (Parent/Child/Both/None) - `IgnoreCase` (
bool) — Case-insensitive search. Default: true - `IgnoreAccent` (
bool) — Ignore accents (remote data only). Default: false
Example
<SfGantt DataSource="@TaskCollection" Toolbar="@(new List<string>() { "Search" })">
<GanttSearchSettings Fields="@(new string[] { "TaskName", "Duration" })"
Operator="Operator.Contains"
IgnoreCase="true">
</GanttSearchSettings>
</SfGantt>---
GanttTimelineSettings
Configures timeline display and behavior.
Properties
- `TopTier` (
GanttTimelineTierSettings) — Top tier settings (unit, format, count) - `BottomTier` (
GanttTimelineTierSettings) — Bottom tier settings - `TimelineUnitSize` (
int) — Width of timeline cell in pixels. Default: 33 - `TimelineViewMode` (
TimelineViewMode) — Timeline view mode (None/Hour/Day/Week/Month/Year). Default: None - `ShowTooltip` (
bool) — Show tooltip on timeline cell hover. Default: true - `UpdateTimescaleView` (
bool) — Auto-update timescale on edit. Default: true - `WeekStartDay` (
int) — Week start day (0=Sunday, 1=Monday, etc.). Default: 0 - `WeekendBackground` (
string?) — Weekend cell background color. Default: null
Example
<SfGantt DataSource="@TaskCollection">
<GanttTimelineSettings TimelineUnitSize="60"
TimelineViewMode="TimelineViewMode.Week"
WeekStartDay="1"
ShowTooltip="true">
<GanttTopTierSettings Unit="TimelineViewMode.Month" Format="MMM yyyy">
</GanttTopTierSettings>
<GanttBottomTierSettings Unit="TimelineViewMode.Week" Format="dd">
</GanttBottomTierSettings>
</GanttTimelineSettings>
</SfGantt>---
GanttTimelineTierSettings
Configures individual timeline tier (top or bottom).
Properties
- `Unit` (
TimelineViewMode) — Time unit (Hour/Day/Week/Month/Year) - `Format` (
string) — Date format string (e.g., "MMM dd, yyyy") - `Count` (
int) — Number of units per cell. Default: 1 - `Formatter` (
stringorRenderFragment) — Custom format function/template
---
GanttSplitterSettings
Configures splitter pane (divider between grid and chart).
Properties
- `Position` (
string) — Initial splitter position in pixels or percentage (e.g., "250px", "30%"). Default: 250px - `ColumnIndex` (
int) — Column index where splitter is positioned. Default: -1 - `Minimum` (
string) — Minimum width of grid part. Default: null - `SeparatorSize` (
double) — Splitter bar width in pixels. Default: 4 - `View` (
SplitterView) — Predefined view (Default/Grid/Chart). Default: Default Default: Show both grid and chartGrid: Show grid onlyChart: Show chart only- `Collapsible` (
bool) — Enable expand/collapse icon near splitter. Default: false
Example
<SfGantt DataSource="@TaskCollection" Height="450px" Width="100%">
<GanttSplitterSettings Position="30%"
Minimum="200px"
SeparatorSize="6"
Collapsible="true">
</GanttSplitterSettings>
</SfGantt>---
GanttTooltipSettings<TValue>
Configures tooltip behavior and templates.
Properties
- `ShowTooltip` (
bool) — Enable tooltips. Default: true - `TaskbarTemplate` (
RenderFragment<TValue>) — Custom taskbar tooltip template - `ConnectorLineTemplate` (
RenderFragment<TValue>) — Custom connector line tooltip template - `EditingTemplate` (
RenderFragment<TValue>) — Custom editing tooltip template - `Template` (
RenderFragment<TValue>) — General tooltip template
Example
<SfGantt DataSource="@TaskCollection">
<GanttTooltipSettings ShowTooltip="true" TValue="TaskData">
<TaskbarTemplate>
@{
var task = context as TaskData;
<div>
<strong>@task.TaskName</strong><br />
Duration: @task.Duration days<br />
Progress: @task.Progress%
</div>
}
</TaskbarTemplate>
</GanttTooltipSettings>
</SfGantt>---
GanttLabelSettings<TValue>
Configures taskbar label display.
Properties
- `LeftLabel` (
string) — Field name for left taskbar label - `RightLabel` (
string) — Field name for right taskbar label - `TaskLabel` (
string) — Field name for task label inside taskbar - `LeftLabelTemplate` (
RenderFragment<TValue>) — Custom left label template - `RightLabelTemplate` (
RenderFragment<TValue>) — Custom right label template - `TaskLabelTemplate` (
RenderFragment<TValue>) — Custom task label template
Example
<SfGantt DataSource="@TaskCollection">
<GanttLabelSettings LeftLabel="TaskName"
RightLabel="Progress"
TaskLabel="Duration"
TValue="TaskData">
</GanttLabelSettings>
</SfGantt>---
GanttTaskbarSettings
Configures advanced taskbar behavior.
Properties
- `EnableMultiTaskbar` (
bool) — Enable rendering multiple taskbars for same resource. Default: false - `AllowTaskbarDragAndDrop` (
bool) — Enable taskbar drag-and-drop between rows. Default: false - `ShowParentTaskbar` (
bool) — Show parent taskbar. Default: true
Example
<SfGantt DataSource="@TaskCollection">
<GanttTaskbarSettings EnableMultiTaskbar="true"
AllowTaskbarDragAndDrop="true">
</GanttTaskbarSettings>
</SfGantt>---
GanttCriticalPathSettings
Configures critical path highlighting.
Properties
- `SlackValue` (
int) — Slack threshold in days for critical path. Default: 0
Example
<SfGantt DataSource="@TaskCollection" EnableCriticalPath="true">
<GanttCriticalPathSettings SlackValue="2">
</GanttCriticalPathSettings>
</SfGantt>---
GanttKeySettings
Configures keyboard shortcuts.
Properties
Various keyboard shortcut mappings (e.g., MoveLeftCell, MoveRightCell, DeleteRecord, etc.)
Example
<SfGantt DataSource="@TaskCollection">
<GanttKeySettings MoveLeftCell="Shift+LeftArrow"
MoveRightCell="Shift+RightArrow">
</GanttKeySettings>
</SfGantt>---
GanttColumnChooserSettings
Configures column chooser behavior.
Properties
Properties for customizing which columns appear in the column chooser and their order.
---
Export Settings Classes
GanttPdfExportProperties
Properties for PDF export: FileName, PageOrientation, PageSize, Theme, IncludeHiddenColumns, custom headers/footers.
GanttExcelExportProperties
Properties for Excel/CSV export: FileName, IncludeHiddenColumns, ExcelTheme.
PdfMultiPageSettings
Multi-page PDF export configuration.
PdfLabelSettings
PDF label customization.
---
Usage Notes
- Nested Components: Settings classes are declared as child components within
<SfGantt>:
<SfGantt>
<GanttEditSettings ... />
<GanttSelectionSettings ... />
</SfGantt>- Two-Way Binding: Most settings support property binding for dynamic configuration.
- Events: Many settings classes trigger events on the parent
SfGanttcomponent (e.g., editing triggersOnActionBegin,OnActionComplete).
- Grid Parity: Several settings (Selection, Filter, Sort, Search) mirror Syncfusion Grid component equivalents for consistency.
---
Assignment Fields and Resource Mapping — API Reference
Comprehensive guide for GanttAssignmentFields<TValue, TAssignment> class, which manages the many-to-many relationship between tasks and resources through resource assignment collections.
Table of Contents
- Overview
- GanttAssignmentFields Class
- Properties
- Configuration Pattern
- Resource Assignment Methods
- Foreign Key Relationships
- CRUD Operations
- Events
- Common Patterns
- Troubleshooting
---
Overview
The GanttAssignmentFields<TValue, TAssignment> component establishes the connection between tasks and resources by mapping a resource assignment collection. This collection acts as a junction table that holds the relationships between tasks and resources, enabling multiple resources to be assigned to a single task and tracking allocation units (percentage of time dedicated).
When to use:
- Assigning multiple resources to tasks
- Tracking resource allocation percentages (units)
- Implementing resource views grouped by resource
- Managing resource assignment CRUD operations programmatically
- Establishing many-to-many relationships between tasks and resources
---
GanttAssignmentFields Class
Namespace: Syncfusion.Blazor.Gantt
Type Parameters:
- `TValue` — Type of task collection data source
- `TAssignment` — Type of resource assignment collection data source
Inheritance: SfOwningComponentBase → GanttAssignmentFields<TValue, TAssignment>
Implements: IComponent, IHandleEvent, IHandleAfterRender, IDisposable
---
Properties
DataSource
Type: IEnumerable<TAssignment>
The resource assignment collection that contains the many-to-many relationship data between tasks and resources.
Required: Yes
Example:
<GanttAssignmentFields DataSource="@AssignmentCollection" ...>
</GanttAssignmentFields>
@code {
private List<ResourceAssignment> AssignmentCollection { get; set; }
}---
PrimaryKey
Type: string
The primary key property name in the assignment collection that uniquely identifies each assignment record.
Required: Yes
Example:
<GanttAssignmentFields PrimaryKey="PrimaryId" ...>
</GanttAssignmentFields>
public class ResourceAssignment
{
public int PrimaryId { get; set; } // Unique identifier
public int TaskId { get; set; }
public int ResourceId { get; set; }
}---
TaskID
Type: string
The property name in the assignment collection that maps to the task's primary key (from GanttTaskFields.Id). This establishes the foreign key relationship to the task collection.
Required: Yes
Example:
<GanttAssignmentFields TaskID="TaskId" ...>
</GanttAssignmentFields>---
ResourceID
Type: string
The property name in the assignment collection that maps to the resource's primary key (from GanttResource.Id). This establishes the foreign key relationship to the resource collection.
Required: Yes
Example:
<GanttAssignmentFields ResourceID="ResourceId" ...>
</GanttAssignmentFields>---
Units
Type: string
The property name that specifies the allocation percentage for a resource on a task. Represents the percentage of time or capacity a resource dedicates to the task.
Default: 100% if not specified
Common Values:
100— Full-time allocation (100% of resource's capacity)50— Half-time allocation (50% of resource's capacity)300— Three full-time equivalent resources working on task
Example:
<GanttAssignmentFields Units="Unit" ...>
</GanttAssignmentFields>
public class ResourceAssignment
{
public int PrimaryId { get; set; }
public int TaskId { get; set; }
public int ResourceId { get; set; }
public double Unit { get; set; } = 100; // Default 100%
}---
DataManager
Type: DataManager
Instance of DataManager for remote data binding scenarios. Facilitates interactions with remote data sources for resource assignment operations.
Example:
<GanttAssignmentFields DataManager="@AssignmentDataManager" ...>
</GanttAssignmentFields>
@code {
private DataManager AssignmentDataManager { get; set; }
}---
ResourceAssignmentChanging
Type: EventCallback<ResourceAssignmentChangeEventArgs<TAssignment>>
Event raised when resource assignments are added, updated, or deleted. Provides details about the assignment collections being modified.
Event Args Properties:
AddedRecords— List of newly added assignmentsChangedRecords— List of modified assignmentsDeletedRecords— List of removed assignments
Example:
<GanttAssignmentFields ResourceAssignmentChanging="@OnAssignmentChanging" ...>
</GanttAssignmentFields>
@code {
private void OnAssignmentChanging(ResourceAssignmentChangeEventArgs<ResourceAssignment> args)
{
Console.WriteLine($"Added: {args.AddedRecords?.Count ?? 0}");
Console.WriteLine($"Changed: {args.ChangedRecords?.Count ?? 0}");
Console.WriteLine($"Deleted: {args.DeletedRecords?.Count ?? 0}");
}
}---
Configuration Pattern
Complete Setup Example
@using Syncfusion.Blazor.Gantt
<SfGantt @ref="GanttInstance"
DataSource="@TaskCollection"
Height="450px"
Width="100%">
<GanttTaskFields Id="TaskId"
Name="TaskName"
StartDate="StartDate"
EndDate="EndDate"
Duration="Duration">
</GanttTaskFields>
<GanttResource DataSource="@ResourceCollection"
Id="ResourceId"
Name="ResourceName"
MaxUnits="MaxUnits"
TValue="TaskData"
TResources="ResourceData">
</GanttResource>
<GanttAssignmentFields DataSource="@AssignmentCollection"
PrimaryKey="PrimaryId"
TaskID="TaskId"
ResourceID="ResourceId"
Units="Unit"
TValue="TaskData"
TAssignment="ResourceAssignment">
</GanttAssignmentFields>
<GanttLabelSettings RightLabel="Resources" TValue="TaskData">
</GanttLabelSettings>
</SfGantt>
@code {
private SfGantt<TaskData> GanttInstance;
private List<TaskData> TaskCollection { get; set; }
private List<ResourceData> ResourceCollection { get; set; }
private List<ResourceAssignment> AssignmentCollection { get; set; }
protected override void OnInitialized()
{
TaskCollection = GetTasks();
ResourceCollection = GetResources();
AssignmentCollection = GetAssignments();
}
// Task model
public class TaskData
{
public int TaskId { get; set; }
public string TaskName { get; set; }
public DateTime StartDate { get; set; }
public DateTime? EndDate { get; set; }
public string Duration { get; set; }
}
// Resource model
public class ResourceData
{
public int ResourceId { get; set; }
public string ResourceName { get; set; }
public double MaxUnits { get; set; }
}
// Resource assignment model (junction table)
public class ResourceAssignment
{
public int PrimaryId { get; set; } // Unique identifier
public int TaskId { get; set; } // Foreign key to TaskData
public int ResourceId { get; set; } // Foreign key to ResourceData
public double Unit { get; set; } = 100; // Allocation percentage
}
private List<TaskData> GetTasks()
{
return new List<TaskData>
{
new TaskData { TaskId = 1, TaskName = "Project Planning", StartDate = new DateTime(2024, 1, 1), Duration = "5" },
new TaskData { TaskId = 2, TaskName = "Design Phase", StartDate = new DateTime(2024, 1, 8), Duration = "3" },
new TaskData { TaskId = 3, TaskName = "Development", StartDate = new DateTime(2024, 1, 15), Duration = "10" }
};
}
private List<ResourceData> GetResources()
{
return new List<ResourceData>
{
new ResourceData { ResourceId = 1, ResourceName = "John Doe", MaxUnits = 100 },
new ResourceData { ResourceId = 2, ResourceName = "Jane Smith", MaxUnits = 100 },
new ResourceData { ResourceId = 3, ResourceName = "Bob Johnson", MaxUnits = 100 }
};
}
private List<ResourceAssignment> GetAssignments()
{
return new List<ResourceAssignment>
{
// Task 1: Assigned to John (100%) and Jane (50%)
new ResourceAssignment { PrimaryId = 1, TaskId = 1, ResourceId = 1, Unit = 100 },
new ResourceAssignment { PrimaryId = 2, TaskId = 1, ResourceId = 2, Unit = 50 },
// Task 2: Assigned to Jane (100%)
new ResourceAssignment { PrimaryId = 3, TaskId = 2, ResourceId = 2, Unit = 100 },
// Task 3: Assigned to John (50%) and Bob (100%)
new ResourceAssignment { PrimaryId = 4, TaskId = 3, ResourceId = 1, Unit = 50 },
new ResourceAssignment { PrimaryId = 5, TaskId = 3, ResourceId = 3, Unit = 100 }
};
}
}---
Resource Assignment Methods
AddResourceAssignmentAsync<TAssignment>(TAssignment)
Adds a new resource assignment to a task programmatically.
Parameters:
resourceAssignment(TAssignment) — New assignment with TaskID, ResourceID, and Units
Returns: Task
Example:
<button @onclick="AddAssignment">Add Resource</button>
<SfGantt @ref="GanttInstance" DataSource="@TaskCollection">
<GanttAssignmentFields DataSource="@AssignmentCollection"
PrimaryKey="PrimaryId"
TaskID="TaskId"
ResourceID="ResourceId"
Units="Unit"
TValue="TaskData"
TAssignment="ResourceAssignment">
</GanttAssignmentFields>
</SfGantt>
@code {
private async Task AddAssignment()
{
var newAssignment = new ResourceAssignment
{
PrimaryId = AssignmentCollection.Max(a => a.PrimaryId) + 1,
TaskId = 2, // Assign to task 2
ResourceId = 3, // Assign resource 3 (Bob)
Unit = 75 // 75% allocation
};
await GanttInstance.AddResourceAssignmentAsync(newAssignment);
}
}---
UpdateResourceAssignmentAsync<TAssignment>(TAssignment)
Updates an existing resource assignment based on its primary key.
Parameters:
resourceAssignment(TAssignment) — Updated assignment data with PrimaryKey
Returns: Task
Example:
private async Task UpdateAssignment()
{
var existingAssignment = AssignmentCollection.First(a => a.PrimaryId == 3);
existingAssignment.Unit = 80; // Change from 100% to 80%
await GanttInstance.UpdateResourceAssignmentAsync(existingAssignment);
}---
DeleteResourceAssignmentAsync<TAssignment>(TAssignment)
Removes a resource assignment from a task.
Parameters:
resourceAssignment(TAssignment) — Assignment to remove (must include TaskID and ResourceID)
Returns: Task
Example:
private async Task RemoveAssignment()
{
var assignmentToRemove = new ResourceAssignment
{
TaskId = 2,
ResourceId = 2 // Remove Jane from task 2
};
await GanttInstance.DeleteResourceAssignmentAsync(assignmentToRemove);
}---
Foreign Key Relationships
Relationship Diagram
TaskCollection (Tasks) ResourceCollection (Resources)
TaskId (PK) ←─────┐ ┌─────→ ResourceId (PK)
TaskName │ │ ResourceName
StartDate │ │ MaxUnits
│ │
│ │
AssignmentCollection (Junction Table)
PrimaryId (PK)
TaskId (FK) ──────────┘
ResourceId (FK) ───────┘
Unit (allocation %)Key Rules
1. PrimaryKey must be unique in assignment collection 2. TaskID must match an existing task's GanttTaskFields.Id 3. ResourceID must match an existing resource's GanttResource.Id 4. One task can have multiple assignments (multiple resources) 5. One resource can be assigned to multiple tasks
---
CRUD Operations
Adding Tasks with Resources
private async Task AddTaskWithResources()
{
// 1. Add the task
var newTask = new TaskData
{
TaskId = 10,
TaskName = "New Feature",
StartDate = DateTime.Now,
Duration = "5"
};
await GanttInstance.AddRecordAsync(newTask);
// 2. Add resource assignments
var assignment1 = new ResourceAssignment
{
PrimaryId = GetNextAssignmentId(),
TaskId = 10,
ResourceId = 1,
Unit = 100
};
var assignment2 = new ResourceAssignment
{
PrimaryId = GetNextAssignmentId(),
TaskId = 10,
ResourceId = 2,
Unit = 50
};
await GanttInstance.AddResourceAssignmentAsync(assignment1);
await GanttInstance.AddResourceAssignmentAsync(assignment2);
}Reassigning Resources
private async Task ReassignResource()
{
// Remove old assignment
var oldAssignment = AssignmentCollection
.First(a => a.TaskId == 5 && a.ResourceId == 1);
await GanttInstance.DeleteResourceAssignmentAsync(oldAssignment);
// Add new assignment
var newAssignment = new ResourceAssignment
{
PrimaryId = GetNextAssignmentId(),
TaskId = 5,
ResourceId = 3, // Different resource
Unit = 100
};
await GanttInstance.AddResourceAssignmentAsync(newAssignment);
}---
Events
ResourceAssignmentChanging Event
Tracks all changes to resource assignments in a single event.
<GanttAssignmentFields ResourceAssignmentChanging="@OnAssignmentChange" ...>
</GanttAssignmentFields>
@code {
private void OnAssignmentChange(ResourceAssignmentChangeEventArgs<ResourceAssignment> args)
{
if (args.AddedRecords?.Count > 0)
{
foreach (var added in args.AddedRecords)
{
Console.WriteLine($"Added: Task {added.TaskId} → Resource {added.ResourceId} ({added.Unit}%)");
}
}
if (args.ChangedRecords?.Count > 0)
{
foreach (var changed in args.ChangedRecords)
{
Console.WriteLine($"Changed: Assignment {changed.PrimaryId} → Unit {changed.Unit}%");
}
}
if (args.DeletedRecords?.Count > 0)
{
foreach (var deleted in args.DeletedRecords)
{
Console.WriteLine($"Deleted: Task {deleted.TaskId} ← Resource {deleted.ResourceId}");
}
}
}
}---
Common Patterns
Pattern 1: Multiple Resources Per Task
// Assign 3 resources to a single task with different allocation levels
var assignments = new List<ResourceAssignment>
{
new ResourceAssignment { PrimaryId = 1, TaskId = 5, ResourceId = 1, Unit = 100 }, // Full-time
new ResourceAssignment { PrimaryId = 2, TaskId = 5, ResourceId = 2, Unit = 50 }, // Half-time
new ResourceAssignment { PrimaryId = 3, TaskId = 5, ResourceId = 3, Unit = 25 } // Quarter-time
};
foreach (var assignment in assignments)
{
await GanttInstance.AddResourceAssignmentAsync(assignment);
}Pattern 2: Resource View
Enable resource-centric view to group tasks by assigned resources:
<SfGantt ViewType="ViewType.ResourceView" ...>
<GanttAssignmentFields ...>
</GanttAssignmentFields>
</SfGantt>Pattern 3: Checking Existing Assignments
public List<ResourceAssignment> GetTaskAssignments(int taskId)
{
return AssignmentCollection.Where(a => a.TaskId == taskId).ToList();
}
public List<ResourceAssignment> GetResourceAssignments(int resourceId)
{
return AssignmentCollection.Where(a => a.ResourceId == resourceId).ToList();
}---
Troubleshooting
Issue: Resources Not Displaying
Cause: Missing or incorrect foreign key mappings
Solution:
// Verify all mappings are correct
<GanttAssignmentFields
DataSource="@AssignmentCollection"
PrimaryKey="PrimaryId" // ✓ Unique in assignment collection
TaskID="TaskId" // ✓ Matches GanttTaskFields.Id
ResourceID="ResourceId" // ✓ Matches GanttResource.Id
Units="Unit"
TValue="TaskData"
TAssignment="ResourceAssignment">
</GanttAssignmentFields>Issue: Assignment Methods Not Working
Cause: Missing component reference
Solution:
<SfGantt @ref="GanttInstance" ...> <!-- Add @ref -->
</SfGantt>
@code {
private SfGantt<TaskData> GanttInstance; // Declare reference
}Issue: Units Not Appearing
Cause: Units property not mapped or null
Solution:
public class ResourceAssignment
{
public double Unit { get; set; } = 100; // Default value
}Clipboard and Accessibility — Developer Reference
Comprehensive guide to clipboard operations, copy/paste functionality, autofill features, and accessibility best practices for the Blazor Gantt Chart component.
---
Table of Contents
- Clipboard Operations
- Copy Methods
- Copy Hierarchy Modes
- Paste Operations
- Autofill Feature
- Clipboard Properties
- Keyboard Shortcuts
- Accessibility Guidelines
- ARIA and Screen Readers
- Best Practices
---
Clipboard Operations
The clipboard feature enables copying selected row or cell data from the Gantt Chart component to the clipboard for use in external applications.
Basic Clipboard Usage
<SfGantt DataSource="@TaskCollection" Height="450px" Width="1000px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate"
EndDate="EndDate" Duration="Duration" Progress="Progress">
</GanttTaskFields>
</SfGantt>Default keyboard shortcuts:
- Ctrl + C — Copy selected rows or cells
- Ctrl + Shift + H — Copy with header row
Selection Prerequisites
Clipboard operations require proper selection configuration:
<SfGantt DataSource="@TaskCollection">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate">
</GanttTaskFields>
<GanttSelectionSettings Mode="SelectionMode.Cell" Type="SelectionType.Multiple">
</GanttSelectionSettings>
</SfGantt>Selection modes for clipboard:
- Row selection — Copies entire rows with all column values
- Cell selection — Copies individual cell values
- Multiple selection — Enables copying multiple rows/cells
---
Copy Methods
CopyAsync Method
Signature:
public Task CopyAsync(bool? withHeader = null)Parameters:
withHeader(bool?, optional) — Whentrue, includes column headers in copied data. Default:false
Returns: Task — Asynchronous operation
Description: Copies selected rows or cells to the clipboard. Can be invoked programmatically through external buttons or custom logic.
Programmatic Copy Example
@using Syncfusion.Blazor.Gantt
@using Syncfusion.Blazor.Navigations
<SfGantt @ref="Gantt" DataSource="@TaskCollection" Height="450px" Width="1000px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate"
EndDate="EndDate" Duration="Duration">
</GanttTaskFields>
<SfToolbar ID="Gantt_Gantt_Toolbar">
<ToolbarItems>
<ToolbarItem Id="copyHeader" Text="Copy With Header"
OnClick="ToolbarClick" PrefixIcon="e-copy">
</ToolbarItem>
<ToolbarItem Id="copy" Text="Copy"
OnClick="ToolbarClick" PrefixIcon="e-copy">
</ToolbarItem>
</ToolbarItems>
</SfToolbar>
</SfGantt>
@code {
private SfGantt<TaskData> Gantt;
private List<TaskData> TaskCollection { get; set; }
public async void ToolbarClick(ClickEventArgs args)
{
var selectedRecords = await Gantt.GetSelectedRecordsAsync();
if (selectedRecords.Count() > 0)
{
bool withHeader = (args.Item.Id == "copyHeader");
await Gantt.CopyAsync(withHeader);
}
}
public class TaskData
{
public int TaskID { get; set; }
public string TaskName { get; set; }
public DateTime StartDate { get; set; }
public DateTime? EndDate { get; set; }
public string Duration { get; set; }
public int Progress { get; set; }
}
protected override void OnInitialized()
{
TaskCollection = GetTaskCollection();
}
private List<TaskData> GetTaskCollection()
{
return new List<TaskData>()
{
new TaskData() {
TaskID = 1,
TaskName = "Project initiation",
StartDate = new DateTime(2022, 04, 05),
Duration = "3",
Progress = 30
},
new TaskData() {
TaskID = 2,
TaskName = "Identify Site location",
StartDate = new DateTime(2022, 04, 05),
Duration = "2",
Progress = 50
}
};
}
}---
Copy Hierarchy Modes
The Gantt Chart supports multiple hierarchical copy modes via the CopyHierarchyMode property.
CopyHierarchyType Enum
public enum CopyHierarchyType
{
Parent, // Copy selected records with parent records
Child, // Copy selected records with child records
Both, // Copy selected records with both parents and children
None // Copy only selected records
}Mode Descriptions
| Mode | Behavior | Use Case |
|---|---|---|
| Parent | Copies selected records + all parent ancestors | Preserve task context when copying subtasks |
| Child | Copies selected records + all child descendants | Export parent with complete task breakdown |
| Both | Copies selected records + parents + children | Full hierarchy export for external analysis |
| None | Copies only selected records (no hierarchy) | Flat data export without relationships |
Hierarchy Mode Example
@using Syncfusion.Blazor.Gantt
@using Syncfusion.Blazor.TreeGrid
@using Syncfusion.Blazor.DropDowns
<SfDropDownList TValue="string" TItem="DropdownData" @bind-Value="@CopyMode"
DataSource="@CopyModes" Width="200px">
<DropDownListEvents TValue="string" TItem="DropdownData"
ValueChange="OnTypeChange">
</DropDownListEvents>
<DropDownListFieldSettings Text="Mode" Value="Id">
</DropDownListFieldSettings>
</SfDropDownList>
<SfGantt @ref="Gantt" DataSource="@TaskCollection"
CopyHierarchyMode="@CopyType" Height="450px" Width="1000px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate"
Duration="Duration" ParentID="ParentID">
</GanttTaskFields>
<SfToolbar ID="Gantt_Gantt_Toolbar">
<ToolbarItems>
<ToolbarItem Id="copy" Text="Copy" OnClick="ToolbarClick"
PrefixIcon="e-copy">
</ToolbarItem>
</ToolbarItems>
</SfToolbar>
</SfGantt>
@code {
private SfGantt<TaskData> Gantt;
private List<TaskData> TaskCollection { get; set; }
public string CopyMode { get; set; } = "Parent";
public CopyHierarchyType CopyType { get; set; } = CopyHierarchyType.Parent;
public List<DropdownData> CopyModes { get; set; } = new List<DropdownData>();
public class DropdownData
{
public string Id { get; set; }
public string Mode { get; set; }
}
protected override void OnInitialized()
{
TaskCollection = GetTaskCollection();
CopyModes.Add(new DropdownData() { Id = "Parent", Mode = "Parent" });
CopyModes.Add(new DropdownData() { Id = "Child", Mode = "Child" });
CopyModes.Add(new DropdownData() { Id = "Both", Mode = "Both" });
CopyModes.Add(new DropdownData() { Id = "None", Mode = "None" });
}
private void OnTypeChange(ChangeEventArgs<string, DropdownData> args)
{
CopyType = args.Value switch
{
"Parent" => CopyHierarchyType.Parent,
"Child" => CopyHierarchyType.Child,
"Both" => CopyHierarchyType.Both,
"None" => CopyHierarchyType.None,
_ => CopyHierarchyType.Parent
};
}
public async void ToolbarClick(ClickEventArgs args)
{
var selectedRecords = await Gantt.GetSelectedRecordsAsync();
if (selectedRecords.Count() > 0)
{
await Gantt.CopyAsync(false);
}
}
public class TaskData
{
public int TaskID { get; set; }
public string TaskName { get; set; }
public DateTime StartDate { get; set; }
public string Duration { get; set; }
public int? ParentID { get; set; }
}
private List<TaskData> GetTaskCollection()
{
return new List<TaskData>()
{
new TaskData() { TaskID = 1, TaskName = "Project initiation",
StartDate = new DateTime(2022, 04, 05), Duration = "5" },
new TaskData() { TaskID = 2, TaskName = "Identify Site location",
StartDate = new DateTime(2022, 04, 05), Duration = "2", ParentID = 1 },
new TaskData() { TaskID = 3, TaskName = "Perform soil test",
StartDate = new DateTime(2022, 04, 07), Duration = "3", ParentID = 1 }
};
}
}---
Paste Operations
The Gantt Chart supports custom paste operations for both row paste (full record duplication) and cell paste (value copying across cells).
Row Paste
Copy and paste entire rows with hierarchy preservation.
Keyboard shortcuts:
- Ctrl + C — Copy selected row(s)
- Ctrl + V — Paste copied row(s)
@using Syncfusion.Blazor.Gantt
@using Syncfusion.Blazor.Grids
<SfGantt @ref="Gantt" DataSource="@TaskCollection" @onkeyup="KeyUp"
Height="450px" Width="1000px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate"
Duration="Duration" ParentID="ParentID">
</GanttTaskFields>
<GanttSelectionSettings Type="SelectionType.Multiple">
</GanttSelectionSettings>
<GanttEditSettings AllowAdding="true"></GanttEditSettings>
<GanttEvents BeforeCopy="BeforeCopyHandler"
RowSelected="RowSelect"
RowDeselected="RowDeselect"
TValue="TaskData">
</GanttEvents>
</SfGantt>
@code {
private SfGantt<TaskData> Gantt;
private List<TaskData> TaskCollection { get; set; }
public List<TaskData> CopiedRecords { get; set; } = new List<TaskData>();
public double SelectedIndex { get; set; }
public void RowDeselect(RowDeselectEventArgs<TaskData> args)
{
SelectedIndex = -1;
}
private void BeforeCopyHandler(BeforeCopyEventArgs args)
{
var columns = Gantt.GetColumnsAsync().Result;
var clipboardText = args.ClipboardText;
if (!string.IsNullOrEmpty(clipboardText))
{
var records = clipboardText.Split("\n");
int index = 0;
foreach (var record in records)
{
var columnValues = record.Split("\t");
int colIndex = 0;
int newId = TaskCollection.Max(a => a.TaskID) + 1;
TaskData ganttData = new TaskData();
foreach (var col in columns)
{
if (col.Field == Gantt.TaskFields.Id)
{
ganttData.GetType().GetProperty(col.Field)
.SetValue(ganttData, newId + index);
}
else if (col.Type == Syncfusion.Blazor.Grids.ColumnType.Date)
{
ganttData.GetType().GetProperty(col.Field)
.SetValue(ganttData, Convert.ToDateTime(columnValues[colIndex]));
}
else if (col.Type == Syncfusion.Blazor.Grids.ColumnType.String)
{
ganttData.GetType().GetProperty(col.Field)
.SetValue(ganttData, columnValues[colIndex]);
}
colIndex++;
}
index++;
CopiedRecords.Add(ganttData);
}
}
}
public void RowSelect(RowSelectEventArgs<TaskData> args)
{
SelectedIndex = args.RowIndex;
}
private async Task KeyUp(KeyboardEventArgs args)
{
if (args.CtrlKey && args.Code == "KeyV"
&& CopiedRecords.Count > 0 && SelectedIndex > -1)
{
var parentID = TaskCollection[(int)SelectedIndex].ParentID;
for (var i = 0; i < CopiedRecords.Count; i++)
{
CopiedRecords[i].ParentID = parentID;
await Gantt.AddRecordAsync(CopiedRecords[i], (int)SelectedIndex,
RowPosition.Above);
}
CopiedRecords = new List<TaskData>();
}
}
public class TaskData
{
public int TaskID { get; set; }
public string TaskName { get; set; }
public DateTime StartDate { get; set; }
public string Duration { get; set; }
public int Progress { get; set; }
public int? ParentID { get; set; }
}
protected override void OnInitialized()
{
TaskCollection = GetTaskCollection();
}
private List<TaskData> GetTaskCollection()
{
return new List<TaskData>()
{
new TaskData() { TaskID = 1, TaskName = "Project initiation",
StartDate = new DateTime(2022, 04, 05), Duration = "3" },
new TaskData() { TaskID = 2, TaskName = "Identify Site",
StartDate = new DateTime(2022, 04, 05), Duration = "2", ParentID = 1 }
};
}
}Cell Paste
Copy and paste individual cell values across multiple cells.
Keyboard shortcuts:
- Ctrl + C — Copy selected cell(s)
- Ctrl + V — Paste to target cell(s)
@using Syncfusion.Blazor.Gantt
@using Syncfusion.Blazor.Grids
<SfGantt @ref="Gantt" DataSource="@TaskCollection"
@onkeydown="KeyDown" @onkeyup="KeyUp"
Height="450px" Width="1000px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate"
Duration="Duration" Progress="Progress">
</GanttTaskFields>
<GanttSelectionSettings Mode="SelectionMode.Cell"
Type="SelectionType.Multiple">
</GanttSelectionSettings>
<GanttEditSettings AllowEditing="true"></GanttEditSettings>
<GanttEvents CellSelected="CellSelected"
CellDeselected="CellDeselected"
TValue="TaskData">
</GanttEvents>
</SfGantt>
@code {
private SfGantt<TaskData> Gantt;
private List<TaskData> TaskCollection { get; set; }
public int SelectedIndex { get; set; }
private List<ValueTuple<int, int>> clonedRecordIndex;
public void CellDeselected(CellDeselectEventArgs<TaskData> args)
{
SelectedIndex = -1;
}
public void CellSelected(CellSelectEventArgs<TaskData> args)
{
SelectedIndex = Convert.ToInt32(args.RowIndex);
}
private async Task KeyDown(KeyboardEventArgs args)
{
if (args.CtrlKey && args.Code == "KeyC")
{
clonedRecordIndex = await Gantt.GetSelectedRowCellIndexesAsync();
}
}
private async Task KeyUp(KeyboardEventArgs args)
{
if (args.CtrlKey && args.Code == "KeyV"
&& clonedRecordIndex != null && clonedRecordIndex.Count > 0
&& SelectedIndex > -1)
{
var columns = await Gantt.GetColumnsAsync();
var currentRecords = Gantt.GetCurrentViewRecords();
// Group cell indexes by row
IDictionary<double, List<double>> clonedRecords =
new Dictionary<double, List<double>>();
foreach (var cellIndex in clonedRecordIndex)
{
if (!clonedRecords.ContainsKey(cellIndex.Item1))
{
clonedRecords[cellIndex.Item1] = new List<double>();
}
clonedRecords[cellIndex.Item1].Add(cellIndex.Item2);
}
// Paste to target rows
for (int i = 0; i < clonedRecords.Count; i++)
{
double sourceRowIndex = clonedRecords.ElementAt(i).Key;
List<double> cellIndexes = clonedRecords.ElementAt(i).Value;
TaskData sourceRecord = currentRecords[Convert.ToInt32(sourceRowIndex)];
if (SelectedIndex + i < currentRecords.Count)
{
TaskData targetRecord = currentRecords[SelectedIndex + i];
foreach (var cellIdx in cellIndexes)
{
GanttColumn col = columns[Convert.ToInt32(cellIdx)];
if (!col.IsPrimaryKey)
{
var value = sourceRecord.GetType().GetProperty(col.Field)
.GetValue(sourceRecord);
targetRecord.GetType().GetProperty(col.Field)
.SetValue(targetRecord, value);
}
}
await Gantt.UpdateRecordByIDAsync(targetRecord);
}
}
}
}
public class TaskData
{
public int TaskID { get; set; }
public string TaskName { get; set; }
public DateTime StartDate { get; set; }
public string Duration { get; set; }
public int Progress { get; set; }
}
protected override void OnInitialized()
{
TaskCollection = GetTaskCollection();
}
private List<TaskData> GetTaskCollection()
{
return new List<TaskData>()
{
new TaskData() { TaskID = 1, TaskName = "Task 1",
StartDate = new DateTime(2022, 04, 05),
Duration = "3", Progress = 30 },
new TaskData() { TaskID = 2, TaskName = "Task 2",
StartDate = new DateTime(2022, 04, 08),
Duration = "4", Progress = 50 }
};
}
}---
Autofill Feature
The autofill feature enables quickly filling multiple cells with the same value through drag selection or keyboard shortcuts.
Configuration Requirements
To enable autofill, configure the following selection settings:
<GanttSelectionSettings AllowDragSelection="true"
Mode="SelectionMode.Cell"
Type="SelectionType.Multiple"
CellSelectionMode="CellSelectionMode.Box">
</GanttSelectionSettings>Property details:
AllowDragSelection— Enables drag-to-select functionalityMode— Must beCellfor cell-level operationsType— Must beMultiplefor multi-cell selectionCellSelectionMode— UseBoxfor rectangular selection
Autofill Keyboard Shortcut
Default shortcut: Alt + Drag or Alt (hold) during multi-cell selection
Autofill Implementation
@using Syncfusion.Blazor.Gantt
@using Syncfusion.Blazor.Grids
<SfGantt @ref="Gantt" DataSource="@TaskCollection" @onkeyup="KeyUp"
Height="450px" Width="1000px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate"
Duration="Duration" Progress="Progress">
</GanttTaskFields>
<GanttSelectionSettings AllowDragSelection="true"
Mode="SelectionMode.Cell"
Type="SelectionType.Multiple"
CellSelectionMode="CellSelectionMode.Box">
</GanttSelectionSettings>
<GanttEditSettings AllowEditing="true"></GanttEditSettings>
<GanttEvents CellSelected="CellSelectedHandler"
CellDeselected="CellDeselectedHandler"
TValue="TaskData">
</GanttEvents>
</SfGantt>
@code {
private SfGantt<TaskData> Gantt;
private List<TaskData> TaskCollection { get; set; }
private object Value { get; set; }
private string ColumnField { get; set; }
private void CellSelectedHandler(CellSelectEventArgs<TaskData> args)
{
// Capture first selected cell value
if (Value == null)
{
var columns = Gantt.GetColumnsAsync().Result;
ColumnField = columns[Convert.ToInt32(args.CellIndex)].Field;
Value = args.Data.GetType().GetProperty(ColumnField).GetValue(args.Data);
}
}
private void CellDeselectedHandler()
{
Value = null;
}
private async Task KeyUp(KeyboardEventArgs args)
{
// Trigger autofill on Alt key release
if (args.Code == "AltLeft" || args.Code == "AltRight")
{
var selectedCells = await Gantt.GetSelectedRowCellIndexesAsync();
List<TaskData> autofillData = new List<TaskData>();
// Gather all selected rows
foreach (var cellIndex in selectedCells)
{
TaskData record = Gantt.GetCurrentViewRecords()
.ElementAt(Convert.ToInt32(cellIndex.Item1));
if (!autofillData.Contains(record))
{
autofillData.Add(record);
}
}
// Apply captured value to all selected cells
foreach (var record in autofillData)
{
record.GetType().GetProperty(ColumnField).SetValue(record, Value);
await Gantt.UpdateRecordByIDAsync(record);
}
}
}
public class TaskData
{
public int TaskID { get; set; }
public string TaskName { get; set; }
public DateTime StartDate { get; set; }
public string Duration { get; set; }
public int Progress { get; set; }
}
protected override void OnInitialized()
{
TaskCollection = GetTaskCollection();
}
private List<TaskData> GetTaskCollection()
{
return new List<TaskData>()
{
new TaskData() { TaskID = 1, TaskName = "Task 1",
StartDate = new DateTime(2022, 04, 05),
Duration = "3", Progress = 30 },
new TaskData() { TaskID = 2, TaskName = "Task 2",
StartDate = new DateTime(2022, 04, 08),
Duration = "4", Progress = 50 },
new TaskData() { TaskID = 3, TaskName = "Task 3",
StartDate = new DateTime(2022, 04, 12),
Duration = "2", Progress = 70 }
};
}
}Autofill Workflow
1. Select first cell — Click cell with value to autofill 2. Drag to select range — Hold Alt and drag to select target cells 3. Release Alt — Autofill triggers, copying first value to all selected cells
---
Clipboard Properties
CopyHierarchyMode
Type: CopyHierarchyType Default: Parent
Description: Controls hierarchical data inclusion when copying selected records.
<SfGantt DataSource="@TaskCollection" CopyHierarchyMode="CopyHierarchyType.Both">
</SfGantt>Available values:
Parent— Include parent recordsChild— Include child recordsBoth— Include both parents and childrenNone— Selected records only
EnableHtmlSanitizer
Type: bool Default: true
Description: Sanitizes HTML content in cells before rendering to prevent XSS attacks. When enabled, HTML tags in copied/pasted data are encoded.
<SfGantt DataSource="@TaskCollection" EnableHtmlSanitizer="true">
</SfGantt>Security considerations:
- Enabled — HTML tags encoded:
<script>→<script> - Disabled — Raw HTML rendered (potential security risk)
When to disable:
- Trusted data sources only
- Custom HTML rendering required
- Rich text formatting needed
---
Keyboard Shortcuts
Built-In Shortcuts
| Shortcut | Action | Context |
|---|---|---|
| Ctrl + C | Copy selected rows/cells | Row or cell selection active |
| Ctrl + Shift + H | Copy with header | Row or cell selection active |
| Ctrl + V | Paste (custom implementation) | Target row/cell selected |
| Alt + Drag | Autofill selection | Drag selection enabled |
| Arrow Keys | Navigate cells/rows | Grid focused |
| Tab / Shift + Tab | Navigate interactive elements | Focus management |
| Enter / F2 | Edit cell/row | Edit mode enabled |
| Escape | Cancel edit/close dialog | Edit or dialog active |
Custom Keyboard Bindings
Use @onkeyup and @onkeydown events for custom shortcuts:
<SfGantt @onkeydown="HandleKeyDown" @onkeyup="HandleKeyUp">
</SfGantt>
@code {
private async Task HandleKeyDown(KeyboardEventArgs args)
{
if (args.CtrlKey && args.Code == "KeyD")
{
// Custom: Ctrl + D for duplicate
await DuplicateSelectedRow();
}
}
}---
Accessibility Guidelines
Keyboard Navigation
The Gantt Chart must support complete keyboard navigation for accessibility compliance (WCAG 2.1 Level AA).
Essential keyboard workflows:
- Tab navigation — Move between toolbar, grid, chart, and dialogs
- Arrow keys — Navigate rows and cells
- Enter — Activate selected item or enter edit mode
- Escape — Cancel action or close dialog
- Space — Toggle selection (checkboxes, dropdowns)
<SfGantt DataSource="@TaskCollection" AllowSelection="true">
<GanttSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single">
</GanttSelectionSettings>
</SfGantt>Focus Management
Best practices:
- Visible focus indicators on all interactive elements
- Logical focus order (left-to-right, top-to-bottom)
- Focus trapped in modal dialogs until dismissed
- Focus returns to trigger element after dialog closes
/* Ensure visible focus outlines */
.e-gantt .e-row:focus,
.e-gantt .e-cell:focus {
outline: 2px solid #0078d4;
outline-offset: -2px;
}Screen Reader Support
ARIA attributes automatically applied:
role="grid"— Grid containerrole="row"— Row elementsrole="gridcell"— Cell elementsaria-selected— Selection statearia-expanded— Expansion state (parent tasks)
Custom template accessibility:
<GanttColumn Field="TaskName" HeaderText="Task Name">
<Template>
@{
var task = (context as TaskData);
<div role="gridcell" aria-label="@($"Task: {task.TaskName}")">
@task.TaskName
</div>
}
</Template>
</GanttColumn>---
ARIA and Screen Readers
Built-In ARIA Support
Syncfusion Gantt Chart includes baseline ARIA support for screen readers:
Automatic ARIA attributes:
- Grid structure (
role="grid",role="row",role="gridcell") - Selection state (
aria-selected="true|false") - Expansion state (
aria-expanded="true|false") - Sort state (
aria-sort="ascending|descending|none") - Labels (
aria-label,aria-labelledby)
Custom Template Considerations
When using custom templates, preserve accessibility:
❌ Poor accessibility:
<Template>
<i class="e-icons e-edit"></i>
</Template>✅ Good accessibility:
<Template>
<button type="button" aria-label="Edit task" class="e-btn e-icon-btn">
<i class="e-icons e-edit"></i>
</button>
</Template>High Contrast Mode
Support users with visual impairments:
<SfGantt DataSource="@TaskCollection" CssClass="e-gantt-highcontrast">
</SfGantt>/* High contrast styles */
.e-gantt-highcontrast .e-row {
border: 1px solid #000;
}
.e-gantt-highcontrast .e-row:focus {
outline: 3px solid #fff;
outline-offset: 2px;
}---
Best Practices
Clipboard Best Practices
1. Enable appropriate selection mode
- Use
Rowfor full-record copying - Use
Cellfor granular data copying - Use
Multiplefor bulk operations
2. Validate copied data
- Use
BeforeCopyevent to inspect/transform data - Block sensitive columns from clipboard
- Log copy operations for auditing
<GanttEvents BeforeCopy="ValidateCopy" TValue="TaskData"></GanttEvents>
@code {
private void ValidateCopy(BeforeCopyEventArgs args)
{
if (IsSensitiveDataSelected())
{
args.Cancel = true;
ShowNotification("Cannot copy sensitive data");
}
}
}3. Provide copy feedback
- Show toast notification after copy
- Indicate copied row count
- Display copy mode (with/without header)
Accessibility Best Practices
1. Keyboard support
- Test all workflows with keyboard only
- Provide keyboard alternatives for mouse actions
- Document keyboard shortcuts in help text
2. Visual clarity
- Maintain 4.5:1 text contrast ratio
- Use color + text/icons (not color alone)
- Show visible focus indicators
3. Template accessibility
- Include meaningful text for screen readers
- Add
aria-labelto icon-only buttons - Preserve semantic HTML structure
4. Testing checklist
- ✅ Navigate entire Gantt with Tab key
- ✅ Select/edit tasks with keyboard
- ✅ Test with screen reader (NVDA, JAWS, Narrator)
- ✅ Verify high contrast mode support
- ✅ Test with 200% browser zoom
Performance Considerations
Large datasets with clipboard:
- Limit copied records (e.g., max 1000 rows)
- Use
CopyHierarchyMode.Nonefor flat data - Consider pagination for very large datasets
<GanttEvents BeforeCopy="LimitCopySize" TValue="TaskData"></GanttEvents>
@code {
private void LimitCopySize(BeforeCopyEventArgs args)
{
var selectedCount = await Gantt.GetSelectedRecordsAsync();
if (selectedCount.Count() > 1000)
{
args.Cancel = true;
ShowNotification("Cannot copy more than 1000 records");
}
}
}---
Summary
The Blazor Gantt Chart provides comprehensive clipboard and accessibility features:
- Clipboard operations — Programmatic and keyboard-driven copy/paste
- Hierarchy modes — Parent, Child, Both, None for context-aware copying
- Autofill — Rapid cell value duplication with drag selection
- Paste customization — Row and cell-level paste implementations
- Keyboard support — Complete workflows accessible via keyboard
- ARIA compliance — Screen reader friendly with proper semantic markup
- Security — HTML sanitization prevents XSS attacks
Column Basics and Formatting
Table of Contents
- When to Use
- Define Columns with GanttColumns
- Column Types
- Number Formatting
- Date Formatting
- AutoFit Columns
- Show or Hide Columns
- Change Tree Column Position
- Responsive Columns with HideAtMedia
- Control Column-Level Actions
- Key Properties and APIs
- Common Scenarios and Decisions
- Troubleshooting
---
When to Use
Guide the user to this reference when they need to:
- Define which task fields appear as grid columns and in what order
- Apply number or date formatting to column values
- Show or hide columns programmatically or via column chooser
- Auto-fit column widths to content
- Move the tree expand/collapse icons to a different column
- Hide columns at specific screen widths (responsive)
- Enable or disable sorting, filtering, editing, resizing, or reordering per column
---
Define Columns with GanttColumns
When the user wants explicit control over grid columns (fields, headers, widths, alignment), define GanttColumn entries inside GanttColumns. If GanttColumns is omitted, the component auto-generates columns from GanttTaskFields.
To add columns not in GanttTaskFields (e.g., custom Status, WorkersCount), include them as additional GanttColumn entries.
If Field does not exist in the data model, the column renders empty.@using Syncfusion.Blazor.Gantt
<SfGantt DataSource="@TaskCollection" Height="450px" Width="700px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentID">
</GanttTaskFields>
<GanttColumns>
<GanttColumn Field="TaskID" Width="100"></GanttColumn>
<GanttColumn Field="TaskName" HeaderText="Job Name" Width="200"></GanttColumn>
<GanttColumn Field="StartDate" HeaderText="Start Date" Width="150" Format="d"
TextAlign="Syncfusion.Blazor.Grids.TextAlign.Right">
</GanttColumn>
<GanttColumn Field="Duration" HeaderText="Duration" Width="120"></GanttColumn>
<GanttColumn Field="Progress" HeaderText="Progress" Width="120" Format="N2"
Type="Syncfusion.Blazor.Grids.ColumnType.Integer">
</GanttColumn>
<!-- Custom field not in GanttTaskFields -->
<GanttColumn Field="Status" HeaderText="Status" Width="150"></GanttColumn>
</GanttColumns>
</SfGantt>
@code {
private List<TaskData> TaskCollection { get; set; }
protected override void OnInitialized()
{
TaskCollection = new List<TaskData>
{
new TaskData { TaskID = 1, TaskName = "Project initiation", StartDate = new DateTime(2022, 04, 05), EndDate = new DateTime(2022, 04, 21), Status = "Progress" },
new TaskData { TaskID = 2, TaskName = "Identify site location", StartDate = new DateTime(2022, 04, 05), Duration = "0", Progress = 30, ParentID = 1, Status = "Progress" },
new TaskData { TaskID = 3, TaskName = "Perform soil test", StartDate = new DateTime(2022, 04, 05), Duration = "4", Progress = 40, ParentID = 1, Status = "Hold" },
new TaskData { TaskID = 4, TaskName = "Project estimation", StartDate = new DateTime(2022, 04, 06), EndDate = new DateTime(2022, 04, 21), Status = "Progress" },
new TaskData { TaskID = 5, TaskName = "Develop floor plan", StartDate = new DateTime(2022, 04, 06), Duration = "3", Progress = 30, ParentID = 4, Status = "PostPoned" }
};
}
public class TaskData
{
public int TaskID { get; set; }
public string TaskName { get; set; }
public DateTime StartDate { get; set; }
public DateTime? EndDate { get; set; }
public string Duration { get; set; }
public int Progress { get; set; }
public string Status { get; set; }
public int? ParentID { get; set; }
}
}---
Column Types
When the user needs explicit type handling for formatting or filtering, set the Type property using Syncfusion.Blazor.Grids.ColumnType.
Supported types:
| Type | Use for |
|---|---|
String | Text fields (default) |
Integer / Double / Decimal / Long | Numeric fields |
Boolean | True/false checkbox display |
Date | Date-only values |
DateTime | Date and time values |
DateOnly | DateOnly model properties (additional columns only) |
TimeOnly | TimeOnly model properties (additional columns only) |
Checkbox | Dedicated checkbox column |
DateOnlyandTimeOnlytypes are supported only for additional columns (not GanttTaskFields-mapped columns).
<GanttColumn Field="StartDate" HeaderText="Start Date"
Format="dd/MM/yyyy hh:mm"
Type="Syncfusion.Blazor.Grids.ColumnType.DateTime"
Width="150">
</GanttColumn>
<GanttColumn Field="Progress" HeaderText="Progress"
Type="Syncfusion.Blazor.Grids.ColumnType.Integer"
Format="P2" Width="150">
</GanttColumn>---
Number Formatting
When the user wants to control how numeric values display (decimal places, currency, percentage), use the Format property.
| Format | Description | Example output |
|---|---|---|
N / N2 | Numeric with decimal places | 1,234.56 |
C / C2 | Currency | $1,234.56 |
P / P2 | Percentage (input 0–1 range) | 45.00% |
Format strings apply to display only — the underlying data value is unchanged.
<SfGantt DataSource="@TaskCollection" Height="450px" Width="700px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentID">
</GanttTaskFields>
<GanttColumns>
<GanttColumn Field="TaskID" Width="150" Format="N2"></GanttColumn>
<GanttColumn Field="TaskName" HeaderText="Job Name" Width="250"></GanttColumn>
<GanttColumn Field="Progress" Format="P2" Width="200"></GanttColumn>
</GanttColumns>
</SfGantt>---
Date Formatting
When the user wants to control the date display format in columns, set Format to a date pattern string.
| Format string | Output |
|---|---|
"d" | Short date: 4/5/2022 |
"dd/MM/yyyy" | 05/04/2022 |
"MM/dd/yyyy" | 04/05/2022 |
"dd.MM.yyyy" | 05.04.2022 |
"dd/MM/yyyy hh:mm tt" | 05/04/2022 12:00 AM |
<SfGantt DataSource="@TaskCollection" Height="450px" Width="700px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentID">
</GanttTaskFields>
<GanttColumns>
<GanttColumn Field="TaskID" Width="100"></GanttColumn>
<GanttColumn Field="TaskName" HeaderText="Job Name" Width="250"></GanttColumn>
<GanttColumn Field="StartDate" Format="@DateFormat"></GanttColumn>
</GanttColumns>
</SfGantt>
@code {
private string DateFormat = "MM/dd/yyyy";
}---
AutoFit Columns
When the user wants column widths to automatically fit their content, enable AllowResizing="true" (users can double-click the column header resizer) or call AutoFitColumnsAsync programmatically.
Programmatic autofit on initial load — call it in the DataBound event:
<SfGantt @ref="Gantt" DataSource="@TaskCollection" Height="450px" Width="700px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentID">
</GanttTaskFields>
<GanttEvents DataBound="DataBoundHandler" TValue="TaskData"></GanttEvents>
</SfGantt>
@code {
private SfGantt<TaskData> Gantt;
private async void DataBoundHandler(object args)
{
// Auto-fit specific columns by field name
await Gantt.AutoFitColumnsAsync(new string[] { "TaskName", "StartDate", "EndDate" });
}
}---
Show or Hide Columns
When the user needs to toggle column visibility programmatically, use ShowColumnsAsync and HideColumnsAsync. Pass the header text or field name and specify which identifier is used.
<button @onclick="ShowColumns">Show</button>
<button @onclick="HideColumns">Hide</button>
<SfGantt @ref="Gantt" DataSource="@TaskCollection" Height="450px" Width="900px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentID">
</GanttTaskFields>
<GanttColumns>
<GanttColumn Field="TaskID" Width="100"></GanttColumn>
<GanttColumn Field="TaskName" HeaderText="Task Name" Width="250"></GanttColumn>
<GanttColumn Field="Duration"></GanttColumn>
<GanttColumn Field="Progress"></GanttColumn>
</GanttColumns>
</SfGantt>
@code {
public SfGantt<TaskData> Gantt;
private string[] columns = { "TaskName", "Duration" };
// Hide by field name
public async Task HideColumns() => await Gantt.HideColumnsAsync(columns, "Field");
// Show by field name
public async Task ShowColumns() => await Gantt.ShowColumnsAsync(columns, "Field");
}Second parameter options:
"Field"— identify columns by theirFieldproperty"HeaderText"— identify columns by theirHeaderTextproperty
---
Change Tree Column Position
When the user wants the expand/collapse tree icons to appear in a column other than the first, set TreeColumnIndex to the 0-based index of the desired column. Default is 0.
<SfGantt DataSource="@TaskCollection" TreeColumnIndex="2" Height="450px" Width="700px">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentID">
</GanttTaskFields>
</SfGantt>---
Responsive Columns with HideAtMedia
When the user wants columns to automatically hide or show based on screen width (responsive layout), use the HideAtMedia property with a CSS media query string.
<GanttColumns>
<!-- Hide TaskID column when browser width >= 700px -->
<GanttColumn Field="TaskID" Width="150" HideAtMedia="(min-width: 700px)"></GanttColumn>
<GanttColumn Field="TaskName" HeaderText="Job Name" Width="250"></GanttColumn>
<GanttColumn Field="StartDate"></GanttColumn>
<!-- Hide Duration column when browser width >= 500px -->
<GanttColumn Field="Duration" HideAtMedia="(min-width: 500px)"></GanttColumn>
</GanttColumns>---
Control Column-Level Actions
When the user wants to lock certain columns from being edited, sorted, filtered, resized, or reordered, set the corresponding Allow* property to false on the GanttColumn. These are per-column overrides; the global setting on SfGantt must also be enabled for the feature to work.
<SfGantt DataSource="@TaskCollection" Height="450px" Width="900px"
AllowSorting="true" AllowFiltering="true" AllowReordering="true" AllowResizing="true">
<GanttTaskFields Id="TaskID" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentID">
</GanttTaskFields>
<GanttColumns>
<GanttColumn Field="TaskID" Width="100" AllowResizing="false"></GanttColumn>
<GanttColumn Field="TaskName" AllowReordering="false" Width="250"></GanttColumn>
<GanttColumn Field="StartDate" AllowEditing="false"></GanttColumn>
<GanttColumn Field="Duration" AllowSorting="false"></GanttColumn>
<GanttColumn Field="Progress" AllowFiltering="false"></GanttColumn>
</GanttColumns>
<GanttEditSettings AllowEditing="true"></GanttEditSettings>
</SfGantt>---
Key Properties and APIs
| Property / Method | Where Used | Purpose |
|---|---|---|
Field | GanttColumn | Maps column to task model property — required |
HeaderText | GanttColumn | Column header label |
Width | GanttColumn | Column width in px or % |
TextAlign | GanttColumn | Left, Center, Right |
Format | GanttColumn | Date/number format string |
Type | GanttColumn | ColumnType enum for explicit data type |
Visible | GanttColumn | false hides column (still exists in model) |
HideAtMedia | GanttColumn | CSS media query to auto-hide on screen size |
TreeColumnIndex | SfGantt | 0-based index of column showing tree icons (default: 0) |
AllowResizing | SfGantt / GanttColumn | Enables column resize via drag |
AllowReordering | SfGantt / GanttColumn | Enables column reorder via drag |
AllowEditing | GanttColumn | Per-column editing permission |
AllowSorting | GanttColumn | Per-column sorting permission |
AllowFiltering | GanttColumn | Per-column filtering permission |
ShowColumnsAsync(cols, by) | SfGantt method | Show columns by "Field" or "HeaderText" |
HideColumnsAsync(cols, by) | SfGantt method | Hide columns by "Field" or "HeaderText" |
AutoFitColumnsAsync(fields) | SfGantt method | Auto-fit column width to content |
---
Common Scenarios and Decisions
User wants to define which columns appear and in what order → Add GanttColumns with explicit GanttColumn entries. Order of entries = column order.
User wants to display a custom field not in GanttTaskFields → Add a GanttColumn with the custom Field name. It must exist in the task model.
User wants to format a date column as `MM/dd/yyyy` → Set Format="MM/dd/yyyy" on the GanttColumn. Works for Date and DateTime types.
User wants to show progress as a percentage → Set Format="P2" and Type="ColumnType.Integer" on the Progress column.
User wants column widths to auto-fit content on load → Call AutoFitColumnsAsync(new string[] { "Field1", "Field2" }) inside the DataBound event.
User wants to hide a column dynamically from code → Call Gantt.HideColumnsAsync(new string[] { "FieldName" }, "Field").
User wants certain columns to not be editable → Set AllowEditing="false" on the specific GanttColumn (global AllowEditing on GanttEditSettings must still be true).
User wants tree icons on the second column instead of the first → Set TreeColumnIndex="1" on SfGantt.
---
Troubleshooting
Column renders empty
- Confirm
Fieldmatches the exact property name in the C# model (case-sensitive) - If the field is custom (not in
GanttTaskFields), ensure the property exists in the task class
Format not applying
- Confirm
Typeis set correctly — date formats requireColumnType.DateorColumnType.DateTime - Format strings apply to display only; check the model value is the correct C# type
`AutoFitColumnsAsync` has no effect
- Call it in the
DataBoundevent, notOnInitialized— data must be loaded first AllowResizing="true"is required onSfGanttfor the autofit gesture on double-click
`ShowColumnsAsync` / `HideColumnsAsync` not working
- Ensure the second parameter matches how you identify columns:
"Field"or"HeaderText" - Values are case-sensitive; match exactly as defined on the
GanttColumn
Rows and Height Configuration
Table of Contents
- Overview
- RowHeight - AutoFitRows - TaskbarHeight - Row Styling - Row Templates - AllowRowDragDrop - Accessibility - Tips - Performance Considerations
---
Overview
Control row height, auto-fit, and row-level styling to optimize the visual layout and readability of the Gantt grid.
RowHeight
The RowHeight property sets the height of each row in pixels:
<SfGantt RowHeight="25">
...
</SfGantt>Default is typically 36px. Adjust based on content density and accessibility needs.
AutoFitRows
Enable automatic row height adjustment to fit content:
<SfGantt AutoFitRows="true">
...
</SfGantt>When enabled, rows expand to show all content without clipping. Useful for multi-line text or templates with dynamic content.
TaskbarHeight
Control the height of taskbar elements on the timeline:
<SfGantt TaskbarHeight="20">
...
</SfGantt>Smaller values create compact timelines; larger values make taskbars more visible.
Row Styling
Apply custom CSS classes or inline styles to rows via RowDataBound event or row templates:
public void OnRowDataBound(RowDataBoundEventArgs<TaskData> args)
{
if (args.Data.Progress == 100)
args.RowElement?.AddClass("row-complete");
if (args.Data.Priority == "High")
args.RowElement?.AddClass("row-priority-high");
}CSS:
.row-complete {
background-color: #e8f5e9;
}
.row-priority-high {
background-color: #ffebee;
}Row Templates
Use row templates for custom row layouts (advanced):
<GanttTemplates>
<RowTemplate Context="task">
<tr>
<td>@task.TaskID</td>
<td class="custom-row">@task.TaskName - @task.Assignee</td>
</tr>
</RowTemplate>
</GanttTemplates>AllowRowDragDrop
Enable row reordering via drag-and-drop:
<SfGantt AllowRowDragDrop="true">
...
</SfGantt>Users can drag rows to reorder tasks and change parent-child hierarchy.
Accessibility
- Ensure adequate
RowHeightfor readability (especially for touch interfaces). - Use semantic row markup and ARIA attributes for screen readers.
- Provide keyboard navigation (arrow keys to move between rows).
Tips
- Use
AutoFitRowssparingly; it can slow rendering for large datasets. - Combine with
EnableVirtualizationto optimize performance. - Color-code rows by priority, status, or completion for quick scanning.
Performance Considerations
- Fixed
RowHeightperforms better thanAutoFitRows. - Large row templates can impact rendering speed. Test with your dataset size.