WPF Binding ItemsSource to a static method?

You need to declare an ObjectDataProvider in the resources.

Up vote 1 down vote favorite 3 share g+ share fb share tw.

I have the following static method in an class called "Article" : public static ObservableCollection GetObservableCollection() { ... } And I'd like to bind this directly to the ItemsSource property of a ComboBox but in the XAML not in code, I can't find the right syntax. It should look something like this I think (EmacGbscCore is the assembly containing Article object) : ItemsSource="{Binding Source={x:Static EmacGbscCore:Article. GetObservableCollection}}" Thank in advance for your help.

Wpf binding methods itemssource link|improve this question asked May 12 '11 at 8:29Karnalta817 62% accept rate.

You need to declare an ObjectDataProvider in the resources: And use this as the source of your binding: ItemsSource"{Binding Source={StaticResource data}}.

1: Didn't know that one – Daniel Hilgarth May 12 '11 at 8:39 Thank you, work like a charm. – Karnalta May 12 '11 at 8:43.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions