This sample demonstrates how to reliably show tooltips and data labels in Release builds of a .NET MAUI SfCartesianChart. Release mode enables code trimming, which can remove types referenced only from XAML (like converters, models, and templates). This guide explains the essentials to keep tooltips and labels functional on real devices and store builds.
- How to keep tooltips and data labels visible in Release mode with .NET MAUI trimming enabled.
- How to structure your data and bindings so templates resolve correctly at runtime.
- How to safeguard converters, view models, and models used by XAML.
- Ensure Chart handlers are registered - Register Syncfusion® core so chart, tooltip, and data label handlers are available in device builds.
- Bind data for tooltips and datalabels - Provide a ViewModel with your data collection and bind it to the chart to enable labels and tooltips.
- Use templates for UI - Define a Tooltip template for formatted values. Define a Data Label template for how labels appear on each point.
- Protect XAML-Only Types from Trimming - Preserve converters, view models, and models referenced from XAML so they aren’t removed in Release builds.
- Validate in Release - Deploy a Release build to device/emulator and confirm tooltips and labels appear as expected.
- Consistent tooltip and label behavior in both Debug and Release builds.
- Reliable UI even with .NET trimming enabled.
- Clear, formatted information on each data point for better readability.
If you are facing a path too long exception when building this example project, close Visual Studio and rename the repository to short and build the project.
For a step-by-step procedure, refer to the How to display tooltip and datalabel in Release Mode .NET MAUI Cartesian Chart? KB article.