-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move DataTemplateSelector to own file in template (#26489)
* Move DataTemplateSelector to own file in template * Update ChipDataTemplateSelector.cs
- Loading branch information
1 parent
c6584a0
commit 366e5c8
Showing
3 changed files
with
15 additions
and
12 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
src/Templates/src/templates/maui-mobile/Pages/Controls/ChipDataTemplateSelector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters