The TooltipTemplate absorbs touch events on windows (works on android, did not try on iOs) and does not pass the event to the button, I also tired with a Label + TapGesture without success. Notice that the same template works with SfCircularChart.
Sample code:
using CommunityToolkit.Maui.Markup;
using CommunityToolkit.Mvvm.Input;
using Syncfusion.Maui.Charts;
using System.Diagnostics;
using System.Windows.Input;
namespace MyNamespace;
public class MySfCartesianChart: SfCartesianChart
{
public MySfCartesianChart()
{
XAxes.Add(new CategoryAxis
{
Title = new ChartAxisTitle().Bind(ChartAxisTitle.TextProperty, nameof(MyChartViewModel.XAxisTitle)),
});
YAxes.Add(new NumericalAxis
{
Title = new ChartAxisTitle().Bind(ChartAxisTitle.TextProperty, nameof(MyChartViewModel.YAxisTitle))
});
this.Series = new ChartSeriesCollection
{
new ColumnSeries
{
XBindingPath = nameof(MyChartItemViewModel.X),
YBindingPath = nameof(MyChartItemViewModel.Y),
EnableTooltip = true,
TooltipTemplate = new DataTemplate(() => new Button
{
BackgroundColor = Colors.White,
TextColor = Colors.Black,
}
.Bind(Button.TextProperty, $"Item.{nameof(MyChartItemViewModel.Label)}")
.Bind(Button.CommandProperty, $"Item.{nameof(MyChartItemViewModel.ShowCommand)}"))
}
.Bind(ChartSeries.ItemsSourceProperty, nameof(MyChartViewModel.Items))
};
this.BindingContext = new MyChartViewModel();
}
}
public class MyChartViewModel
{
public string XAxisTitle { get; set; } = "X axis";
public string YAxisTitle { get; set; } = "Y axis";
public MyChartItemViewModel[] Items { get; set; } = new MyChartItemViewModel[]
{
new MyChartItemViewModel
{
X = "Item 1",
Y = 1,
},
new MyChartItemViewModel
{
X = "Item 2",
Y = 3,
},
new MyChartItemViewModel
{
X = "Item 3",
Y = 2,
}
};
}
public class MyChartItemViewModel
{
public string X { get; set; }
public double Y { get; set; }
public string Label => $"{X} - {Y}";
public ICommand ShowCommand => new RelayCommand(() =>
{
Debug.WriteLine("clicked!"); // never called on windows
});
}
Hi Fabrice,
We have confirmed the reported problem as an issue and we have created a feedback report for it. You can find the feedback report at the link provided below.
We will include a fix for the reported issue (Tooltip template absorbs touch events on windows) in our upcoming weekly NuGet release, which is expected to roll out on January 31, 2022. We will notify you once the release is available.
Please note that the provided feedback link is private and requires login to view it.
Feedback: https://www.syncfusion.com/feedback/40572
Regards,
Raja.
Hi Fabrice,
We are glad to announce that our Essential Studio 2022 Volume 4 Service Pack Release V20.4.0.48 is rolled out and is available for download under the following link and this release includes the fix for the reported issue of "TooltipTemplate absorbing touch events on Windows".
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Best Regards,
Raja.