luismts / ValidationRulesPlugin

Create and validate property rules for all your Xamarin and Windows apps and improve the quality of your data.
https://luismts.com/
MIT License
68 stars 26 forks source link

ValueChanged event firing Twice when value is changed #21

Closed vickism closed 2 years ago

vickism commented 2 years ago

Failure to fill out this information will result in this issue being closed.

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin:1.5.0 Device Tested On: Simulator Tested On: Android Api 31 Version of VS:17.0.5 Version of Xamarin: 5.0

Steps to reproduce the Behavior

  1. Create a Validtable Property to List. public Validatable<string> Value { get; set; }
  2. Subscribe to the Property's On change event. Value.ValueChanged += Value_ValueChanged;

Expected Behaviour

When the value is changed, the ValueChanged event should be called once. However it is triggering twice.

Actual Behavior

The event is trigger twice.

Code snippet

Quick look leads me to believe the cause is here:

So the fix could be for the Value's Setter to update the FormattedValue's backing field or create another event for FormattedValueChanged

luismts commented 2 years ago

Hi @vickism, thanks for taking the time for this.

I will check this and let you know.

luismts commented 2 years ago

A new version was released. Thanks for the feedback @vickism.