diff --git a/src/Templates/src/templates/maui-mobile/AppShell.xaml b/src/Templates/src/templates/maui-mobile/AppShell.xaml
index 738a02e3c786..f25afd290c43 100644
--- a/src/Templates/src/templates/maui-mobile/AppShell.xaml
+++ b/src/Templates/src/templates/maui-mobile/AppShell.xaml
@@ -47,8 +47,8 @@
SegmentWidth="40" SegmentHeight="40">
-
-
+
+
diff --git a/src/Templates/src/templates/maui-mobile/AppShell.xaml.cs b/src/Templates/src/templates/maui-mobile/AppShell.xaml.cs
index 58fb90dc18ef..e88d6057f64a 100644
--- a/src/Templates/src/templates/maui-mobile/AppShell.xaml.cs
+++ b/src/Templates/src/templates/maui-mobile/AppShell.xaml.cs
@@ -13,6 +13,9 @@ public AppShell()
#if (IncludeSampleContent)
var currentTheme = Application.Current!.RequestedTheme;
ThemeSegmentedControl.SelectedIndex = currentTheme == AppTheme.Light ? 0 : 1;
+#endif
+#if ANDROID || WINDOWS
+ SemanticProperties.SetDescription(ThemeSegmentedControl, "Theme selection");
#endif
}
#if (IncludeSampleContent)
diff --git a/src/Templates/src/templates/maui-mobile/Converter/DataLabelValueConverter.cs b/src/Templates/src/templates/maui-mobile/Converter/DataLabelValueConverter.cs
deleted file mode 100644
index 3578fec9097d..000000000000
--- a/src/Templates/src/templates/maui-mobile/Converter/DataLabelValueConverter.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System.Globalization;
-using Microsoft.Maui.Controls;
-using MauiApp._1.Models;
-
-namespace MauiApp._1.Converter;
-
-public class DataLabelValueConverter : IValueConverter
-{
- public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- if (value is CategoryChartData categoryChartData)
- {
- switch (parameter?.ToString())
- {
- case "Title":
- return categoryChartData.Title;
-
- case "Count":
- return categoryChartData.Count;
- }
- }
-
- return value;
- }
-
- public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- return value;
- }
-}
diff --git a/src/Templates/src/templates/maui-mobile/Data/TagRepository.cs b/src/Templates/src/templates/maui-mobile/Data/TagRepository.cs
index 7f2a5ed4a479..a2997c475c74 100644
--- a/src/Templates/src/templates/maui-mobile/Data/TagRepository.cs
+++ b/src/Templates/src/templates/maui-mobile/Data/TagRepository.cs
@@ -200,6 +200,12 @@ public async Task SaveItemAsync(Tag item, int projectID)
await Init();
await SaveItemAsync(item);
+ var isAssociated = await IsAssociated(item, projectID);
+ if (isAssociated)
+ {
+ return 0; // No need to save again if already associated
+ }
+
await using var connection = new SqliteConnection(Constants.DatabasePath);
await connection.OpenAsync();
@@ -212,6 +218,32 @@ public async Task SaveItemAsync(Tag item, int projectID)
return await saveCmd.ExecuteNonQueryAsync();
}
+ ///
+ /// Checks if a tag is already associated with a specific project.
+ ///
+ /// The tag to save.
+ /// The ID of the project.
+ /// If tag is already associated with this project
+ async Task IsAssociated(Tag item, int projectID)
+ {
+ await Init();
+
+ await using var connection = new SqliteConnection(Constants.DatabasePath);
+ await connection.OpenAsync();
+
+ // First check if the association already exists
+ var checkCmd = connection.CreateCommand();
+ checkCmd.CommandText = @"
+ SELECT COUNT(*) FROM ProjectsTags
+ WHERE ProjectID = @projectID AND TagID = @tagID";
+ checkCmd.Parameters.AddWithValue("@projectID", projectID);
+ checkCmd.Parameters.AddWithValue("@tagID", item.ID);
+
+ int existingCount = Convert.ToInt32(await checkCmd.ExecuteScalarAsync());
+
+ return existingCount != 0;
+ }
+
///
/// Deletes a tag from the database.
///
diff --git a/src/Templates/src/templates/maui-mobile/MauiProgram.cs b/src/Templates/src/templates/maui-mobile/MauiProgram.cs
index 32ebbe27ed96..506153c5bfbe 100644
--- a/src/Templates/src/templates/maui-mobile/MauiProgram.cs
+++ b/src/Templates/src/templates/maui-mobile/MauiProgram.cs
@@ -18,6 +18,25 @@ public static MauiApp CreateMauiApp()
#if (IncludeSampleContent)
.UseMauiCommunityToolkit()
.ConfigureSyncfusionToolkit()
+//-:cnd:noEmit
+ .ConfigureMauiHandlers(handlers =>
+ {
+#if WINDOWS
+ Microsoft.Maui.Controls.Handlers.Items.CollectionViewHandler.Mapper.AppendToMapping("KeyboardAccessibleCollectionView", (handler, view) =>
+ {
+ handler.PlatformView.SingleSelectionFollowsFocus = false;
+ });
+
+ Microsoft.Maui.Handlers.ContentViewHandler.Mapper.AppendToMapping(nameof(Pages.Controls.CategoryChart), (handler, view) =>
+ {
+ if (view is Pages.Controls.CategoryChart && handler.PlatformView is ContentPanel contentPanel)
+ {
+ contentPanel.IsTabStop = true;
+ }
+ });
+#endif
+ })
+//+:cnd:noEmit
#endif
.ConfigureFonts(fonts =>
{
diff --git a/src/Templates/src/templates/maui-mobile/PageModels/MainPageModel.cs b/src/Templates/src/templates/maui-mobile/PageModels/MainPageModel.cs
index c0c3d3a10156..d4c6f1ec07cf 100644
--- a/src/Templates/src/templates/maui-mobile/PageModels/MainPageModel.cs
+++ b/src/Templates/src/templates/maui-mobile/PageModels/MainPageModel.cs
@@ -37,7 +37,7 @@ public partial class MainPageModel : ObservableObject, IProjectTaskPageModel
[ObservableProperty]
private Project? selectedProject;
-
+
public bool HasCompletedTasks
=> Tasks?.Any(t => t.IsCompleted) ?? false;
diff --git a/src/Templates/src/templates/maui-mobile/PageModels/ProjectDetailPageModel.cs b/src/Templates/src/templates/maui-mobile/PageModels/ProjectDetailPageModel.cs
index 0d51bd25204a..f87c2acde70a 100644
--- a/src/Templates/src/templates/maui-mobile/PageModels/ProjectDetailPageModel.cs
+++ b/src/Templates/src/templates/maui-mobile/PageModels/ProjectDetailPageModel.cs
@@ -1,6 +1,8 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using MauiApp._1.Models;
+using System.Collections.ObjectModel;
+using System.Windows.Input;
namespace MauiApp._1.PageModels;
@@ -34,6 +36,8 @@ public partial class ProjectDetailPageModel : ObservableObject, IQueryAttributab
[ObservableProperty]
private List _allTags = [];
+ public IList