title: ComboBox values disappears after selected when objects used for display
body: <p>I have a combobox where I want to display objects and have enum values returned. When first opened the combobox displays the items as supposed, but after a value is chosen it seems to disappear from the list. But if the combobox is active I can use the keyboard to navigate up and down between the other values, so they are in the list but only invisible.</p>
  
  <p>I have created a little test application to show my problem. When started the application shows the combobox with all the choices (the two first are type of Object, the third is a String):</p>
  
  <p><a href="https://i.stack.imgur.com/1Y5hN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Y5hN.png" alt="All choices shown on startup"></a>
  </p>
  
  <p>After the blue line is selected and when the combobox is opened again this line is missing:</p>
  
  <p><a href="https://i.stack.imgur.com/InNQs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/InNQs.png" alt="Blue line selected and is missing in popup"></a>
  </p>
  
  <p>When the line with the text "Green" is selected that line is still showing:</p>
  
  <p><a href="https://i.stack.imgur.com/uomHB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uomHB.png" alt="Green line selected and still shown in popup"></a>
  </p>
  
  <p>If I had chosen the red line the only thing that would still be in the list is the test "Green".</p>
  
  <p>I am using .NET Framework 3.5.</p>
  
  <p><b>Any hints or tips to why the elements disappears?</b></p>
  
  <hr>
  
  <p>Here are all the code needed after starting a blank project in Visual Studio.</p>
  
  <p><i>MainWindow.xaml.cs:</i></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Diagnostics;
  
  namespace Test
  {
     public partial class MainWindow
     {
        public MainWindow()
        {
           InitializeComponent();
        }
  
        private ColorComboBoxValue _activeColor;
        public ColorComboBoxValue ActiveColor
        {
           get { return _activeColor; }
           set
           {
              _activeColor = value;
              Debug.WriteLine("ActiveColor: " + _activeColor.Color);
           }
        }
     }
  
     public class ColorList : List&lt;ColorComboBoxValue&gt; { }
  
     public class ColorComboBoxValue
     {
        public Color Color { get; set; }
        public Object Object { get; set; }
     }
  
     public enum Color
     {
        Red,
        Blue,
        Green
     }
  }
  </code></pre>
  
  <p><i>MainWindow.xaml:</i></p>
  
  <pre><code>&lt;Window x:Class="Test.MainWindow" x:Name="window"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:System="clr-namespace:System;assembly=mscorlib"
          xmlns:local="clr-namespace:Test"
          Title="ComboBoxTest" Height="100" Width="200"&gt;
  
      &lt;Window.Resources&gt;
          &lt;local:ColorList x:Key="ColorList"&gt;
              &lt;local:ColorComboBoxValue Color="Red"&gt;
                  &lt;local:ColorComboBoxValue.Object&gt;
                      &lt;Path Data="M0,0 L0,30 60,30 60,0 Z" Fill="Red"/&gt;
                  &lt;/local:ColorComboBoxValue.Object&gt;
              &lt;/local:ColorComboBoxValue&gt;
              &lt;local:ColorComboBoxValue Color="Blue"&gt;
                  &lt;local:ColorComboBoxValue.Object&gt;
                      &lt;Path Data="M0,0 L0,30 60,30 60,0 Z" Fill="Blue"/&gt;
                  &lt;/local:ColorComboBoxValue.Object&gt;
              &lt;/local:ColorComboBoxValue&gt;
              &lt;local:ColorComboBoxValue Color="Green"&gt;
                  &lt;local:ColorComboBoxValue.Object&gt;
                      &lt;System:String&gt;Green&lt;/System:String&gt;
                  &lt;/local:ColorComboBoxValue.Object&gt;
              &lt;/local:ColorComboBoxValue&gt;
          &lt;/local:ColorList&gt;
      &lt;/Window.Resources&gt;
  
      &lt;ComboBox ItemsSource="{Binding Source={StaticResource ColorList}}"
                SelectedItem="{Binding ActiveColor, ElementName=window}"&gt;
          &lt;ComboBox.ItemTemplate&gt;
              &lt;DataTemplate&gt;
                  &lt;ContentPresenter Content="{Binding Path=Object}"/&gt;
              &lt;/DataTemplate&gt;
          &lt;/ComboBox.ItemTemplate&gt;
      &lt;/ComboBox&gt;
  &lt;/Window&gt;
  </code></pre>