Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top