79707555

Date: 2025-07-19 20:44:29
Score: 0.5
Natty:
Report link

It turns out that I missed the null checking in the Case class.

private static void OnPropChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
    if (d is Case _case && _case.SwitchCase != null && _case.SwitchValue != null)
    {
        _case.Content = _case.SwitchCase.ToString() == _case.SwitchValue.ToString() ? _case.SwitchContent : null;
    }
}
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Richard Harrison