wpf - How to pass <collection> as a parameter to constructor of the Markup extension -


i have enum need bind combobox.  public enum ruletype     {         default,         required,         hide,         disable,         validate,         calculate,         maxlength,         trigger     }  // array of class return type of extension 

public class enummember { public object value { get; set; } public string discription { get; set; } }

and have witten markup extension bind above enum directly in xaml:

    [markupextensionreturntype(typeof(array))]     public class enumvaluesextension : markupextension     {         public enumvaluesextension()         {         }         public enumvaluesextension(type enumtype)         {             if (enumtype == null)                 throw new argumentnullexception("enumtype");              this.enumtype = enumtype;             // this.excluded = filtercollection;         }          public enumvaluesextension(type enumtype, ruletype filtercollection)         {             if (enumtype == null)                 throw new argumentnullexception("enumtype");              this.enumtype = enumtype;             this.excluded = filtercollection;         }         public type enumtype         {             { return _enumtype; }             set             {                 if (_enumtype == value)                     return;                 _enumtype = value;             }         }   // returning elements of enum  public override object providevalue(iserviceprovider serviceprovider)         {             return object enumvalue in enum.getvalues(enumtype)                    select new enummember                    {                        value = enumvalue,                        discription = enumvalue.tostring()                    };         }     } } 

xaml binding is:

// "filterdefaultelement" dependency property retrieve enum elements. <style x:key="filterrulecombo" targettype="{x:type combobox}">             <style.triggers>                 <datatrigger binding="{binding elementname=radio0,path=ischecked}" value="true">                     <setter property="itemssource"                              value="{binding filterdefaultelement}"/>                                     </datatrigger>  </style.triggers>         </style>     </window.resources>  <combobox grid.column="0" grid.row="1"  style="{staticresource filterrulecombo}"                                   displaymemberpath="discription" margin="0,5,0,100">           </combobox>  

my question is:

i want write extension constructor like

 public enumvaluesextension(type enumtype, observablecollection<enummember> obj)  {  } 

which should able accept collection parameter. able pass 1 argument constructor.

how can pass "observablecollection obj" parameter constuctor of markup extension?


Comments