I want to populate a combobox control items from an object data provider. The object data provider calls a method on my custom class to get the list of items.
However the method on my custom class expects a parameter before it can return list of items back. I am not sure how to do it.
Here is my attempt:
Object Data Provider declaration:
<ObjectDataProvider x:Key="dataFromEnum" ObjectType="{x:Type ns:MyDataProvider}" MethodName="GetData">
<ObjectDataProvider.MethodParameters>
<sys:String>String.Empty</sys:String>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
ComboBox declaration:
<ComboBox Name="combobox" ItemsSource="{StaticResource dataFromEnum}" Tag="{Binding Path=Name}" />
So as you can see the combo box's Tag property is bound to the Name property of the parent's data context. I want to pass that Name property to the object data provider. I am not sure how to pass the data into the object data provider while requesting data from it.
Please advise.
Thanks.