Vereinsmeisterschaften  22aa7800eae54b428d40e835886cefe1fdefdfdf
This is a software that can be used to manage the internal competition of the swimming club Illertissen called "Vereinsmeisterschaften".
Loading...
Searching...
No Matches
EnumTemplateSelector.cs
3
5{
9 public class EnumTemplateSelector : DataTemplateSelector
10 {
14 public Dictionary<Enum, DataTemplate> Templates { get; } = new();
15
22 public override DataTemplate SelectTemplate(object item, DependencyObject container)
23 {
24 if (item is Enum filter && Templates.TryGetValue(filter, out var template))
25 return template;
26
27 // return empty DataTemplate, if item isn't found in Templates. Nothing is shown then (instead of the default .ToString()).
28 return new DataTemplate();
29 }
30 }
31}
Template selector that returns the DataTemplate depending on the given Enum value.
override DataTemplate SelectTemplate(object item, DependencyObject container)
If the given item is an Enum and the Templates have an entry for this Enum, return the corresponding ...
Dictionary< Enum, DataTemplate > Templates
Dictionary with KeyValuePair<Enum, DataTemplate>