开发者

How to catch SourceUpdated for nested children of window?

开发者 https://www.devze.com 2023-02-06 02:17 出处:网络
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

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开发者_JAVA技巧 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号