Skip to content

Commit

Permalink
Move DataTemplateSelector to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
jfversluis committed Dec 10, 2024
1 parent 9b1fbb3 commit 81ba584
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace DeveloperBalance.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;

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (macos-15)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (macos-15)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (macos-15)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (macos-15)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (macos-15)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 10 in 9.0/Apps/DeveloperBalance/DeveloperBalance/Pages/Controls/ChipDataTemplateSelector.cs

View workflow job for this annotation

GitHub Actions / build (macos-15)

The type or namespace name 'Tag' could not be found (are you missing a using directive or an assembly reference?)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</Border>
</DataTemplate>

<pages:ChipDataTemplateSelector
<controls:ChipDataTemplateSelector
x:Key="ChipDataTemplateSelector"
NormalTagTemplate="{StaticResource NormalTagTemplate}"
SelectedTagTemplate="{StaticResource SelectedTagTemplate}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 81ba584

Please sign in to comment.