title: WPF: populate different enum into my ComBoBox base on condition
body: <p>So I have 2 `enums:</p>
  <pre><code>    [TypeConverter(typeof(EnumDescriptionTypeConverter))]
          public enum A400TypeOption
          {
              [Description(&quot;Temperature&quot;)]
              TEMPERATURE = 0,
      
              [Description(&quot;Humidity sensor&quot;)]
              HUMIDITY = 2,
          }
  
  [TypeConverter(typeof(EnumDescriptionTypeConverter))]
          public enum A700TypeOption
          {
              [Description(&quot;Temperature&quot;)]
              TEMPERATURE = 1,
      
              [Description(&quot;High&quot;)]
              HIGH = 2,
  
              [Description(&quot;Voltage&quot;)]
              VOLTAGE = 3,
          }
  </code></pre>
  <p>I have this <code>EnumBindingSource</code> class:</p>
  <pre><code>public class EnumBindingSourceExtension : MarkupExtension
  {
          private Type _enumType;
  
          public Type EnumType
          {
              get { return this._enumType; }
              set
              {
                  if (value != this._enumType)
                  {
                      if (null != value)
                      {
                          Type enumType = Nullable.GetUnderlyingType(value) ?? value;
                          if (!enumType.IsEnum)
                              throw new ArgumentException(&quot;Type must be for an Enum.&quot;);
                      }
  
                      this._enumType = value;
                  }
              }
          }
  
          public EnumBindingSourceExtension() { }
  
          public EnumBindingSourceExtension(Type enumType)
          {
              this.EnumType = enumType;
          }
  
          public override object ProvideValue(IServiceProvider serviceProvider)
          {
              if (null == this._enumType)
                  throw new InvalidOperationException(&quot;The EnumType must be specified.&quot;);
  
              Type actualEnumType = Nullable.GetUnderlyingType(this._enumType) ?? this._enumType;
              Array enumValues = Enum.GetValues(actualEnumType);
  
              if (actualEnumType == this._enumType)
                  return enumValues;
  
              Array tempArray = Array.CreateInstance(actualEnumType, enumValues.Length + 1);
              enumValues.CopyTo(tempArray, 1);
              return tempArray;
          }
  }
  </code></pre>
  <p>And this is my <code>ComBoBox</code> that get its <code>enum</code>:</p>
  <pre><code>&lt;ComboBox ItemsSource=&quot;{Binding Source={helpers:EnumBindingSource {x:Type tagEnums:A400TypeOption}}}&quot;   
  &lt;/ComboBox&gt;
  </code></pre>
  <p>As you can see, and this example, my <code>ComBoBox</code> populate with the <code>enum</code> <code>A400TypeOption</code>.</p>
  <p>Now I have another <code>ComBoBox</code> that the user can choose between <code>A400</code> and <code>A700</code> and base on this selection I want to populate my <code>ComBoBox</code> with the relevant <code>enum</code> (<code>A400TypeOption</code> or <code>A700TypeOption</code>).
  So I created this <code>int value</code> property in my <code>ViewModel</code>:</p>
  <pre><code>private int enumType;
  
  public int EnumType
  {
      get { return enumType; }
      set
      {
          enumType = value;
          NotifyPropertyChanged(&quot;EnumType&quot;);
      }
  }
  </code></pre>
  <p>And in case the user select <code>A400</code> and the <code>EnumType</code> value is <code>0</code> I want to populate my <code>ComBoBox</code> this way:</p>
  <pre><code>&lt;ComboBox ItemsSource=&quot;{Binding Source={helpers:EnumBindingSource {x:Type tagEnums:A400TypeOption}}}&quot;
  </code></pre>
  <p>And in case the user select <code>A700</code> and the <code>EnumType</code> value is <code>1</code> I want to populate my <code>ComBoBox</code> this way:</p>
  <pre><code>&lt;ComboBox ItemsSource=&quot;{Binding Source={helpers:EnumBindingSource {x:Type tagEnums:A700TypeOption}}}&quot;
  </code></pre>
  <p>So I wonder how can I do that ?
  I think maybe create <code>converter</code> and honesty I don't know what to pass to this <code>converter</code>.</p>
  <p>Any ideas ?</p>