protected override DataTemplate SelectTemplateCore(object item)
        {
            vmStatistic element = (vmStatistic)item;

            if (element.Header)
            {
                return(HeaderTemplate);
            }

            return(ItemTemplate);
        }
        public void SetSource(TennisStatistics Source)
        {
            _Source = Source;

            Children.Clear();

            var allValues = (vmStatistic.StatisticElement[])Enum.GetValues(typeof(vmStatistic.StatisticElement));

            vmStatistic LastHeader = null;

            TennisMatch.LogLevelEnum _LogLevel = Source.currentMatch.LogLevel;

            foreach (var element in allValues)
            {
                if (VisibleLogLevel(_LogLevel, element))
                {
                    vmStatistic newElement = new vmStatistic();
                    newElement.Statistic = element;
                    newElement.Source    = Source;
                    newElement.Visible   = true;
                    // _StatisticElements.Add(newElement);

                    if (newElement.Header)
                    {
                        LastHeader = newElement;
                        _StatisticElements.Add(newElement);
                        Children.Add(LastHeader);
                    }
                    else
                    {
                        if (LastHeader != null)
                        {
                            LastHeader.Children.Add(newElement);
                        }
                    }
                }
            }
        }