문제

I would like to know when any input element on my Window has its Binding source updated.

The input elements could be TextBox, RadioButton, Slider, ComboBox etc, and may be nested within UserControls or Panels.

Catching SourceUpdated would be nice, but it is not a routed event so is not bubbled to the parent.

Is there a simple way to do this?

도움이 되었습니까?

해결책

SourceUpdated does bubble up from nested children, but NotifyOnSourceUpdated needs to be set on the Binding expression:

<StackPanel SourceUpdated="StackPanel_SourceUpdated">
    <TextBox Text="{Binding Path=Val1, NotifyOnSourceUpdated=True}" ></TextBox>
</StackPanel>

I'd still love to hear about a method which does not require setting NotifyOnSourceUpdated for every binding expression.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top