title: WPF binding ComboBox to enum (with a twist)
body: <p>Well the problem is that I have this enum, BUT I don't want the combobox to show the values of the enum. This is the enum:</p>
  
  <pre><code>public enum Mode
      {
          [Description("Display active only")]
          Active,
          [Description("Display selected only")]
          Selected,
          [Description("Display active and selected")]
          ActiveAndSelected
      }
  </code></pre>
  
  <p>So in the ComboBox instead of displaying Active, Selected or ActiveAndSelected, I want to display the DescriptionProperty for each value of the enum. I do have an extension method called GetDescription() for the enum:</p>
  
  <pre><code>public static string GetDescription(this Enum enumObj)
          {
              FieldInfo fieldInfo =
                  enumObj.GetType().GetField(enumObj.ToString());
  
              object[] attribArray = fieldInfo.GetCustomAttributes(false);
  
              if (attribArray.Length == 0)
              {
                  return enumObj.ToString();
              }
              else
              {
                  DescriptionAttribute attrib =
                      attribArray[0] as DescriptionAttribute;
                  return attrib.Description;
              }
          }
  </code></pre>
  
  <p>So is there a way I can bind the enum to the ComboBox AND show it's content with the GetDescription extension method?</p>
  
  <p>Thanks!</p>