1
votes

I have a child window that contains a DataForm. In the DataForm there is a combobox. I have a DataContext set on the parent window that is opening the child window. Before I open the child window, I set the myChildWindow.DataContext = myGlobalDataContext.

I have the ComboBox ItemsSource={Binding Path=MyCollectionInMyGlobalDataContext}

If I put the combobox outside of the dataform on the child window, it populates with data, once I move it inside of the data form, it does not bind to the "MyCollection" collection on the DataContext.

Any thoughts?

2

2 Answers

1
votes

You have probably found the answer by now, but just in case it is probably because the CurrentItem property of the dataform is not set

1
votes

In xaml datasource works in order. If you have define the source of the window as "myGlobalDataContext" and put combo outside the Dataform it will definitely fill it because in this situation combo is the child of the window but when you will put the combo in dataform now dataform is the parent of the combo not the window so you must define the source of combo in the source of dataform's current items data source or redefine the combo source as myGlobalDataContext.MyCollectionInMyGlobalDataContext