using System.Windows.Controls;
using System.Windows;

namespace Elwig.Controls {
    public class WineVarietyTemplateSelector : DataTemplateSelector {
        public override DataTemplate SelectTemplate(object item, DependencyObject container) {
            ContentPresenter presenter = (ContentPresenter)container;
            if (presenter.TemplatedParent is ComboBox) {
                return (DataTemplate)presenter.FindResource("WineVarietyTemplateCollapsed");
            } else {
                return (DataTemplate)presenter.FindResource("WineVarietyTemplateExpanded");
            }
        }
    }
}
