Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF MVVM Light - Binding of SelectedItem not changing
    primarykey
    data
    text
    <p>Quite a few posts around this area, but none are helping me... here's the scenario: I've got two "season" drop downs to simulate a range. If you pick a season in the begin range one, the viewmodele automatically sets the property bound to the end range to the same season (so it defaults to a single year and not a range. Here's what the XAML looks like (removed lot of the formatting attibutes for readability):</p> <pre><code>&lt;ComboBox ItemsSource="{Binding AvailableSeasons, Mode=OneWay}" SelectedItem="{Binding SelectedBeginRangeSeason, Mode=TwoWay}" ItemTemplate="{DynamicResource SeasonItemShortFormat}" /&gt; &lt;ComboBox ItemsSource="{Binding AvailableSeasons, Mode=OneWay}" SelectedItem="{Binding SelectedEndRangeSeason, Mode=TwoWay}" ItemTemplate="{DynamicResource SeasonItemShortFormat}" /&gt; </code></pre> <p>The properties in the view model look like this:</p> <pre><code>private Season _selectedBeginRangeSeason; private const string SelectedBeginRangeSeasonPropertyName = "SelectedBeginRangeSeason"; public Season SelectedBeginRangeSeason { get { return _selectedBeginRangeSeason; } set { if (_selectedBeginRangeSeason != value) { var oldValue = _selectedBeginRangeSeason; _selectedBeginRangeSeason = value; RaisePropertyChanged&lt;Season&gt;(SelectedBeginRangeSeasonPropertyName, oldValue, value, true); } } } private Season _selectedEndRangeSeason; private const string SelectedEndRangeSeasonPropertyName = "SelectedEndRangeSeason"; public Season SelectedEndRangeSeason { get { return _selectedEndRangeSeason; } set { if (_selectedEndRangeSeason != value) { Debug.WriteLine("Updating property SelectedEndRangeSeason..."); var oldValue = _selectedEndRangeSeason; _selectedEndRangeSeason = value; Debug.WriteLine("Broadcasting PropertyChanged event for property SelectedEndRangeSeason..."); RaisePropertyChanged&lt;Season&gt;(SelectedEndRangeSeasonPropertyName, oldValue, value, true); } } } private void UpdateSelectedSeasonSelectors() { // if the end range isn't selected... if (_selectedEndRangeSeason == null) { // automatically select the begin for the end range SelectedEndRangeSeason = _selectedBeginRangeSeason; } } </code></pre> <p>I've verified the end property is being changed both with the debug statements and with unit tests, but the UI isn't changing when I select it... can't figure out what's going on and have looked at this so many different ways...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload