samc
Topic Author
Posts: 19
Joined: 21 Aug 2019, 19:22

NotifyPropertyChanged() triggering actions 2x

25 Sep 2020, 22:47

I'm using NotifyPropertyChanged in my code to notify Noesis when a property has changed. I also have a data trigger setup like this:
<ei:DataTrigger Binding="{Binding ActiveState}" Comparison="Equal" Value="2">
	<ei:PlaySoundAction Source="play_ui_generic_click_01.wav"/>
</ei:DataTrigger>
For some reason, the PlaySoundAction is called twice from the NotifyPropertyChanged() method; I'm not sure why. Can anyone explain this?
GUI.PlayAudio() at \NoesisGUI\Plugins\API\Core\NoesisGUI.cs:line 217
PlaySoundAction.Invoke() at \NoesisGUI\Plugins\API\Interactivity\PlaySoundAction.cs:line 53
TriggerAction.CallInvoke() at \NoesisGUI\Plugins\API\Interactivity\TriggerAction.cs:line 44
TriggerBase.InvokeActions() at \NoesisGUI\Plugins\API\Interactivity\TriggerBase.cs:line 82
DataTrigger.Evaluate() at \NoesisGUI\Plugins\API\Interactivity\DataTrigger.cs:line 88
DataTrigger.EvaluateBindingChange() at \NoesisGUI\Plugins\API\Interactivity\DataTrigger.cs:line 73
PropertyChangedTrigger.OnBindingChanged() at \NoesisGUI\Plugins\API\Interactivity\PropertyChangedTrigger.cs:line 38
PropertyMetadata.OnPropertyChanged() at \NoesisGUI\Plugins\API\Proxies\PropertyMetadataExtend.cs:line 129
[Native Transition]
Extend.NotifyPropertyChanged() at \NoesisGUI\Plugins\API\Core\Extend.cs:line 4494
NotifyPropertyChangedBase.NotifyPropertyChanged() at \Scripts\Runtime\Client\UI\Utilities\NotifyPropertyChangedBase.cs:line 76
The callback happens 2x from the "native transition" from what i can tell..

thanks,
sam

Tags:
 
User avatar
sfernandez
Site Admin
Posts: 2056
Joined: 22 Dec 2011, 19:20

Re: NotifyPropertyChanged() triggering actions 2x

28 Sep 2020, 10:17

I created a small test trying to reproduce this but unfortunately it worked as expected.

I would need a bit more context to identify what could be happening.
Is that trigger part of some DataTemplate or Style?
Is it possible that it was defined in a style and then again locally in the element?

Who is online

Users browsing this forum: No registered users and 2 guests