@ -10,6 +10,8 @@ namespace Avalonia.Controls.Primitives
/// </summary>
/// </summary>
public abstract class RangeBase : TemplatedControl
public abstract class RangeBase : TemplatedControl
{
{
private bool _ isDataContextChanging ;
/// <summary>
/// <summary>
/// Defines the <see cref="Minimum"/> property.
/// Defines the <see cref="Minimum"/> property.
/// </summary>
/// </summary>
@ -74,7 +76,7 @@ namespace Avalonia.Controls.Primitives
private void OnMinimumChanged ( )
private void OnMinimumChanged ( )
{
{
if ( IsInitialized )
if ( IsInitialized & & ! _ isDataContextChanging )
{
{
CoerceValue ( MaximumProperty ) ;
CoerceValue ( MaximumProperty ) ;
CoerceValue ( ValueProperty ) ;
CoerceValue ( ValueProperty ) ;
@ -99,8 +101,9 @@ namespace Avalonia.Controls.Primitives
private void OnMaximumChanged ( )
private void OnMaximumChanged ( )
{
{
if ( IsInitialized )
if ( IsInitialized & & ! _ isDataContextChanging )
{
{
CoerceValue ( MinimumProperty ) ;
CoerceValue ( ValueProperty ) ;
CoerceValue ( ValueProperty ) ;
}
}
}
}
@ -170,6 +173,20 @@ namespace Avalonia.Controls.Primitives
RaiseEvent ( valueChangedEventArgs ) ;
RaiseEvent ( valueChangedEventArgs ) ;
}
}
}
}
/// <inheritdoc />
protected override void OnDataContextBeginUpdate ( )
{
_ isDataContextChanging = true ;
base . OnDataContextBeginUpdate ( ) ;
}
/// <inheritdoc />
protected override void OnDataContextEndUpdate ( )
{
base . OnDataContextEndUpdate ( ) ;
_ isDataContextChanging = false ;
}
/// <summary>
/// <summary>
/// Checks if the double value is not infinity nor NaN.
/// Checks if the double value is not infinity nor NaN.