From time to time I'm running into an ArgumentOutOfRangeException
when calling VisualTreeHelper.GetChild()
.
The exception mentions not to call that method when VisualChildrenCount
equals 0 - which is what the if
right before the call supposedly does.
Am I missing something obvious here? I also tried to access contentPresenter.VisualChildrenCount
but that property is protected.