Binding ComboBox.SelectedItem in Silverlight

前端 未结 2 1174
死守一世寂寞
死守一世寂寞 2020-12-19 13:38

This one is driving me crazy. Here\'s the XAML:

    

        
2条回答
  •  执笔经年
    2020-12-19 13:44

    Of course the binding has to be TwoWay. But setting a ItemsSource to a control doesn't means that the DataContext (where SelectedItem variable should point to) is set. Ensure that combo's DataContext is well set. (in my case, to Page. As selectedStuff is a Page property.

    cmbStuff.DataContext = Me '(from  Page.Load)
    

提交回复
热议问题