views:

60

answers:

1

Hi !

I want to pass for as a parameter for the GetValues method from MyItemSourceProvider a concrete value of MyEnum. How to write it please?

<ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type local:MyItemSourceProvider}">
    <ObjectDataProvider.MethodParameters>
        <!-- ENUM value (e.g. MyEnum.Record1) -->       
    </ObjectDataProvider.MethodParameters>        
</ObjectDataProvider>

method:

public System.Collections.IEnumerable GetValues(MyEnum key) {}
public enum MyEnum {Record1, ...}
A: 

Try this:

<Window.Resources>    
  <local:MyEnum x:Key="valueToPassIn">Record1</local:MyEnum>
  <x:Type x:Key="typeToPassIn" TypeName="local:MyEnum" />      

  <ObjectDataProvider MethodName="GetValues"        
      ObjectType="{x:Type sys:Enum}"        
      x:Key="ExampleEnumValues"
      MethodParameters="{StaticResource valueToPassIn}">        
   </ObjectDataProvider>
 </Window.Resources>
rudigrobler