While working on a universal application (currently only on the side of WP8.1), I came across the following strange thing.
I have a ComboBox, UserControl (located in a WindowsPhone project), it is attached to a virtual machine in a Shared project. Both ItemsSource and SelectedItem are tied to their respective properties in the VM.
When you start the application when you select any item except the first, it works fine. But, when I select the first item, the line displayed in the ComboBox shows the .ToString() method of the VM instead ...
(Btw, this is a simple List<string> , the selected item is string . It could not be much simpler than this: p)
I created an example application containing only this Combobox and a virtual machine. I was able to reproduce this as soon as I asynchronously populated the property associated with the ItemsSource. When you do this in a synchronous manner, it works. But just filling it with async method, you can solve the above problem.
A few screenshots:
The first shows the application when it loads. When the collection changes, the first element of the list is selected. Shown here:

When you click on a ComboBox, you can see its elements as usual: 
Say that you click on any element other than the first, you still get normal behavior: 
So far so normal. Now click on the first item. You will receive the following: 
...
I tried various things, for example, turning it into a list of objects, and not just from strings. Adding a converter to related objects, for debugging purposes only, shows only the actual values โโof the strings. I have no idea how or why the associated SelectedItem unexpectedly shows a DataContext ComboBox ...
You can download the sample application here: http://1drv.ms/1DhklCQ (does not contain binary files, only code)
Does anyone have any ideas?
EDIT: code needed to reproduce this problem:
Create an empty Universal store application (8.1). In the WindowsPhone project, the MainPage.xaml file: I added a simple combobox and will catch the Loaded event.
<ComboBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" />
In your code behind. I assigned a DataContext to the virtual machine. And in the Loaded event, I call VM.LoadData () asynchronously
private VM _vm = new VM(); public MainPage() { this.InitializeComponent(); this.DataContext = _vm; } private async void Page_Loaded(object sender, RoutedEventArgs e) { await _vm.LoadDataAsync(); }
A VM object is defined as follows:
public class VM : INotifyPropertyChanged { private List<string> _items; public List<string> Items { get { return _items; } set { _items = value; _selectedItem = _items.FirstOrDefault(); RaisePropertyChanged("Items"); RaisePropertyChanged("SelectedItem"); } } private string _selectedItem; public string SelectedItem { get { return _selectedItem; } set { _selectedItem = value; RaisePropertyChanged("SelectedItem"); } } public VM() { } public async Task LoadDataAsync() { this.Items = new List<string>() { "a", "b", "c", "d", "e", "f", }; } public event PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged(string propName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propName)); } } }