From 9a479dceb2e495acd2e259adf6f068e6bf0cbd61 Mon Sep 17 00:00:00 2001 From: sheiksyedm Date: Tue, 21 Oct 2025 16:33:50 +0530 Subject: [PATCH] Resolved the chart data label binding issues on release mode. --- .../Pages/Controls/CategoryChart.xaml | 43 ++++++++++++------- .../Pages/Controls/ChartDataLabelConverter.cs | 28 ++++++++++++ 2 files changed, 56 insertions(+), 15 deletions(-) create mode 100644 10.0/Apps/DeveloperBalance/Pages/Controls/ChartDataLabelConverter.cs diff --git a/10.0/Apps/DeveloperBalance/Pages/Controls/CategoryChart.xaml b/10.0/Apps/DeveloperBalance/Pages/Controls/CategoryChart.xaml index 866b95a92..d6ac1fb5a 100644 --- a/10.0/Apps/DeveloperBalance/Pages/Controls/CategoryChart.xaml +++ b/10.0/Apps/DeveloperBalance/Pages/Controls/CategoryChart.xaml @@ -2,17 +2,18 @@ + IsActive="{Binding IsBusy}"> - - + + + + + InnerRadius="0.7"> - - - - + - + diff --git a/10.0/Apps/DeveloperBalance/Pages/Controls/ChartDataLabelConverter.cs b/10.0/Apps/DeveloperBalance/Pages/Controls/ChartDataLabelConverter.cs new file mode 100644 index 000000000..f981be3b0 --- /dev/null +++ b/10.0/Apps/DeveloperBalance/Pages/Controls/ChartDataLabelConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Globalization; +using DeveloperBalance.Models; + +namespace DeveloperBalance.Pages.Controls; + +public class ChartDataLabelConverter : IValueConverter +{ + public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + if (value is CategoryChartData categoryData && parameter is string parameterValue) + { + return parameterValue?.ToLower() switch + { + "title" => categoryData.Title, + "count" => categoryData.Count.ToString(), + _ => value?.ToString() + }; + } + + return value?.ToString(); + } + + public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } +}