diff --git a/src/Templates/src/templates/maui-mobile/Pages/Controls/ChipDataTemplateSelector.cs b/src/Templates/src/templates/maui-mobile/Pages/Controls/ChipDataTemplateSelector.cs new file mode 100644 index 000000000000..55ccbe0cfa52 --- /dev/null +++ b/src/Templates/src/templates/maui-mobile/Pages/Controls/ChipDataTemplateSelector.cs @@ -0,0 +1,14 @@ +using MauiApp._1.Models; + +namespace MauiApp._1.Pages.Controls; + +public class ChipDataTemplateSelector : DataTemplateSelector +{ + public required DataTemplate SelectedTagTemplate { get; set; } + public required DataTemplate NormalTagTemplate { get; set; } + + protected override DataTemplate OnSelectTemplate(object item, BindableObject container) + { + return (item as Tag)?.IsSelected ?? false ? SelectedTagTemplate : NormalTagTemplate; + } +} \ No newline at end of file diff --git a/src/Templates/src/templates/maui-mobile/Pages/ProjectDetailPage.xaml b/src/Templates/src/templates/maui-mobile/Pages/ProjectDetailPage.xaml index b9652a40895e..33b2d0e1d0b2 100644 --- a/src/Templates/src/templates/maui-mobile/Pages/ProjectDetailPage.xaml +++ b/src/Templates/src/templates/maui-mobile/Pages/ProjectDetailPage.xaml @@ -46,7 +46,7 @@ - diff --git a/src/Templates/src/templates/maui-mobile/Pages/ProjectDetailPage.xaml.cs b/src/Templates/src/templates/maui-mobile/Pages/ProjectDetailPage.xaml.cs index 2fc84dc9f272..b6e56aec69cb 100644 --- a/src/Templates/src/templates/maui-mobile/Pages/ProjectDetailPage.xaml.cs +++ b/src/Templates/src/templates/maui-mobile/Pages/ProjectDetailPage.xaml.cs @@ -11,14 +11,3 @@ public ProjectDetailPage(ProjectDetailPageModel model) BindingContext = model; } } - -public class ChipDataTemplateSelector : DataTemplateSelector -{ - public required DataTemplate SelectedTagTemplate { get; set; } - public required DataTemplate NormalTagTemplate { get; set; } - - protected override DataTemplate OnSelectTemplate(object item, BindableObject container) - { - return (item as Tag)?.IsSelected ?? false ? SelectedTagTemplate : NormalTagTemplate; - } -} \ No newline at end of file