@ -375,15 +375,13 @@ namespace Perspex
/// <param name="property">The property.</param>
/// <param name="source">The observable.</param>
/// <param name="priority">The priority of the binding.</param>
/// <param name="validation">The validation methods of the binding.</param>
/// <returns>
/// A disposable which can be used to terminate the binding.
/// </returns>
public IDisposable Bind (
PerspexProperty property ,
IObservable < object > source ,
BindingPriority priority = BindingPriority . LocalValue ,
ValidationMethods validation = ValidationMethods . None )
BindingPriority priority = BindingPriority . LocalValue )
{
Contract . Requires < ArgumentNullException > ( property ! = null ) ;
VerifyAccess ( ) ;
@ -412,8 +410,7 @@ namespace Perspex
. Subscribe ( x = > DirectBindingSet ( property , x ) ) ;
validationSubcription = source
. OfType < ValidationStatus > ( )
. Where ( v = > v . Match ( validation ) )
. Subscribe ( x = > ValidationChanged ( property , x ) ) ;
. Subscribe ( x = > DataValidation ( property , x ) ) ;
s_directBindings . Add ( subscription ) ;
@ -447,7 +444,7 @@ namespace Perspex
GetDescription ( source ) ,
priority ) ;
return v . Add ( source , ( int ) priority , validation ) ;
return v . Add ( source , ( int ) priority ) ;
}
}
@ -458,19 +455,17 @@ namespace Perspex
/// <param name="property">The property.</param>
/// <param name="source">The observable.</param>
/// <param name="priority">The priority of the binding.</param>
/// <param name="validation">The validation methods of the binding.</param>
/// <returns>
/// A disposable which can be used to terminate the binding.
/// </returns>
public IDisposable Bind < T > (
PerspexProperty < T > property ,
IObservable < T > source ,
BindingPriority priority = BindingPriority . LocalValue ,
ValidationMethods validation = ValidationMethods . None )
BindingPriority priority = BindingPriority . LocalValue )
{
Contract . Requires < ArgumentNullException > ( property ! = null ) ;
return Bind ( ( PerspexProperty ) property , source . Select ( x = > ( object ) x ) , priority ) ;
return Bind ( property , source . Select ( x = > ( object ) x ) , priority ) ;
}
/// <summary>
@ -517,13 +512,18 @@ namespace Perspex
}
/// <inheritdoc/>
void IPriorityValueOwner . ValidationChanged ( PriorityValue sender , ValidationStatus status )
void IPriorityValueOwner . Data ValidationChanged( PriorityValue sender , ValidationStatus status )
{
var property = sender . Property ;
ValidationChanged ( property , status ) ;
Data Validation( property , status ) ;
}
protected virtual void ValidationChanged ( PerspexProperty property , ValidationStatus status )
/// <summary>
/// Called when the validation state on a tracked property is changed.
/// </summary>
/// <param name="property">The property whose validation state changed.</param>
/// <param name="status">The new validation state.</param>
protected virtual void DataValidation ( PerspexProperty property , ValidationStatus status )
{
}