When assigning SelectedItem via xaml, the item containers are not generated yet, so GetItemContainerForObject returns null. After that, binding to the SelectedItem is impossible because it's not a dependency property.
A possible fix would be:
- Convert SelectedItem to a dependency property
- Check if ItemsSource.Count == items.Count, if not, dispatcher and try again later