public override DataTemplate SelectTemplate(object item, DependencyObject container)
 {
     ComboBox parentComboBox;
     var comboBoxItem = container.GetVisualParent<ComboBoxItem>();
     if (comboBoxItem == null)
     {
         parentComboBox = container.GetVisualParent<ComboBox>();
         return GetSelectedTemplate(parentComboBox);
     }
     parentComboBox = ItemsControl.ItemsControlFromItemContainer(comboBoxItem) as ComboBox;
     return GetDropDownTemplate(parentComboBox);
 }
 public override DataTemplate SelectTemplate(object item, DependencyObject container)
 {
     ComboBoxItem comboBoxItem = container.GetVisualParent<ComboBoxItem>();
     if (comboBoxItem == null)
     {
         return SelectedTemplate;
     }
     return DropDownTemplate;
        /* ContentPresenter presenter = (ContentPresenter)container;
     if (presenter.TemplatedParent is ComboBox)
     {
         return (DataTemplate)presenter.FindResource("ComboCollapsed");
     }
     else
     {
         return (DataTemplate)presenter.FindResource("ComboExpanded");
     }*/
 }