Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ultimately, it turned out that Windows 7 handles the ValueConverter differently than does Windows XP. If I removed:</p> <pre><code>SelectedItem="{Binding SelectedPerson, Converter={StaticResource PersonRoleToPerson}, Mode=OneWayToSource}" </code></pre> <p>then I got all the proper templating. The issue was in the ValueConverter, although Windows XP was firing it multiple times, while Windows 7 only fired it once at the time the underlying collection notified of it's change (as it should!)</p> <p>My ValueConverter initially returned null in both Convert and ConvertBack (because it was OneWayToSource I only needed ConvertBack). If either method didn't satisfy the type check on the object, null was returned. I now believe this to be a bad practice. Instead it should ultimately return DependencyProperty.UnsetValue if you fall all the way through:</p> <pre><code>public class PlaintiffRoleToPerson : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return DependencyProperty.UnsetValue; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var plaintiff = value as Plaintiff; if (plaintiff != null) { return plaintiff.Person; } return DependencyProperty.UnsetValue; } } </code></pre> <p>Why Windows 7 handled that differently than Windows XP is still a mystery, but I now have everything working. I'm counting down the days until Windows XP hits end of support and I can drop it from our supported OSes.</p>
 

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