I'm binding my combobox to a list here, the SelectedItem is also bound to CurrentCode property in code behind. Now every thing is displayed well and the selected item is set as expected. But let's I'm changing the value of the CurrentCode by clicking a button. Why the combobox doesn't get updated?
<ComboBox ItemsSource="{Binding Path=Codes}" SelectedItem="{Binding CurrentCode, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Mode=OneTime}"/> public partial class SettingsWindow { public List<string> Codes { get; set; } public string CurrentCode { get { return Building.Code; } } public SettingsWindow() { InitializeComponent(); Codes = new List<string> {"ACI Code", "BS Code"}; DataContext = this; } private void OK_OnClick(object sender, RoutedEventArgs e) { Building.Code = "BS Code; } }