I have stumbled upon ObjectDataProvider and I am wondering if I can configure ObjectDataProvider to use the ALREADY EXISTING instance of DataContext. Futhermore since DataContext is usually a ViewModel I would like to call a method in ViewModel through ObjectDataProvider which will return me a list of some string items.
Basically something like this:
<ListBox>
<ListBox.ItemsSource>
<Binding >
<ObjectDataProvider ObjectInstance="Already Existing Instance Of DataContext" MethodName="GiveMeAListOfString">
</ObjectDataProvider>
</Binding>
</ListBox.ItemsSource></ListBox>
Is this possible? I am not sure if I understood ObjectDataProvider completely but it would be awesome if I could use the already existing instances of DataContext and then call a method or get a property value.
Thanks in advance guys for your ideas, solutions & suggetions. I appreciate it much.