I am struggling with the following.
I want to set a ComboBox
's ItemsSource
with a object collection provided from a MarkupExtension
.
Such as:
ItemsSource="{ex:ItemsSource ModelType=m:Category}"
where ItemsSource
is a class ItemsSourceExtension
deriving from MarkupExtension
.
Problem is that when doing so, the ComboBox
's SelectedItem
is null although its binding source has a value.
I have tried a lot. Have tried deriving from
MarkupExtension
and also tried subclassing Binding to no avail.
I want to simulate the use of a standard Binding, where it works fine.
Such as: ItemsSource="{Binding DataContext.Categories, RelativeSource={RelativeSource AncestorType=v:DetailView}}"
Finally figured it out. The
ItemsSource
object collection provided by theMarkupExtension
were originating from differentEntityFramework
DbContext
instances.