I'm new to WPF and the MVVM pattern so I have some problems with my bindings.
In a details view of a customer, I want to list some statuses in a combobox.
In my ViewModel the customer is at the root level, and so is the list of statuses.
When using a static resource, I can use:
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type StackPanel}}, Path=DataContext.PartGruppAll}"
on my ComboBox, but when I set the DataContext from code behind, it does not work, what am I doing wrong, in my opinion it should make no difference.
Best regards, Peter Larsson