Binding a DataGrid ItemSource to an ObservableCollection contained in a MEF Component

Sep 1, 2013 at 6:32 PM
I have an application that is comprised primarily of MEF components. Components that have user interface elements construct the wpf markup in code and return an Element to the main application through an Export (a property). One of the components uses a DataGrid whose ItemSource I want to bind to an ObservableCollection contained in a DataContext that is accessible only to the component itself, not as an Export. If I Export the property in the component that returns the wpf markup will the Binding still remain? In other words, once the markup has been returned to the main window and used in a ContentPresenter, will changes made internally to the bound data (within the MEF component) be reflected in the DataGrid? Or do I need to Export another property that returns an ObservableCollection and bind it to the DataGrid outside of the component? (This approach defeats the purpose of using the MEF component as I don't want to have to know about any internals such as that the component has a DataGrid.)

If further explanation is needed, let me know.