DependencyPropertyChangedEventArgs DependencyPropertyChangedEventArgs DependencyPropertyChangedEventArgs DependencyPropertyChangedEventArgs Struct

정의

다양한 속성 변경 이벤트에 대한 데이터를 제공합니다.Provides data for various property changed events. 일반적으로 이러한 이벤트는 읽기 전용 종속성 속성 값에서 유효한 값이 변경된 내용을 보고합니다.Typically these events report effective value changes in the value of a read-only dependency property. PropertyChangedCallback 구현의 일부로도 사용됩니다.Another usage is as part of a PropertyChangedCallback implementation.

public value class DependencyPropertyChangedEventArgs
public struct DependencyPropertyChangedEventArgs
type DependencyPropertyChangedEventArgs = struct
Public Structure DependencyPropertyChangedEventArgs
상속
DependencyPropertyChangedEventArgsDependencyPropertyChangedEventArgsDependencyPropertyChangedEventArgsDependencyPropertyChangedEventArgs

예제

다음 예제에서는 합니다 DependencyPropertyChangedEventArgs 클래스의 컨텍스트에서 PropertyChangedCallback 도 이벤트를 정의 하는 사용자 지정 클래스의 특정 속성에 대 한 합니다.The following example uses the DependencyPropertyChangedEventArgs class in the context of a PropertyChangedCallback for a particular property of a custom class that also defines events. 콜백에 결과 이전 및 속성 시스템에서 새 값에서 전달한 DependencyPropertyChangedEventArgs, 이러한 다양 한 이벤트 인수 클래스를 가져오며 RoutedPropertyChangedEventArgs<T>합니다.The callback takes the results of old and new values from the property system as communicated by DependencyPropertyChangedEventArgs, and repackages these into a different events arguments class RoutedPropertyChangedEventArgs<T>. 새 인수 다음에 의해 정의 되며 사용자 지정 클래스에 의해 발생 "ValueChanged" 이벤트 데이터로 사용 됩니다.The new arguments are then used as the data for a "ValueChanged" event defined by and raised by the custom class.

public static readonly DependencyProperty ValueProperty =
    DependencyProperty.Register(
        "Value", typeof(decimal), typeof(NumericUpDown),
        new FrameworkPropertyMetadata(MinValue, new PropertyChangedCallback(OnValueChanged),
                                      new CoerceValueCallback(CoerceValue)));

private static object CoerceValue(DependencyObject element, object value)
{
    decimal newValue = (decimal)value;

    newValue = Math.Max(MinValue, Math.Min(MaxValue, newValue));

    return newValue;
}

private static void OnValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{
    NumericUpDown control = (NumericUpDown)obj;

    RoutedPropertyChangedEventArgs<decimal> e = new RoutedPropertyChangedEventArgs<decimal>(
        (decimal)args.OldValue, (decimal)args.NewValue, ValueChangedEvent);
    control.OnValueChanged(e);
}
/// <summary>
/// Identifies the ValueChanged routed event.
/// </summary>
public static readonly RoutedEvent ValueChangedEvent = EventManager.RegisterRoutedEvent(
    "ValueChanged", RoutingStrategy.Bubble,
    typeof(RoutedPropertyChangedEventHandler<decimal>), typeof(NumericUpDown));

/// <summary>
/// Occurs when the Value property changes.
/// </summary>
public event RoutedPropertyChangedEventHandler<decimal> ValueChanged
{
    add { AddHandler(ValueChangedEvent, value); }
    remove { RemoveHandler(ValueChangedEvent, value); }
}
/// <summary>
/// Raises the ValueChanged event.
/// </summary>
/// <param name="args">Arguments associated with the ValueChanged event.</param>
protected virtual void OnValueChanged(RoutedPropertyChangedEventArgs<decimal> args)
{
    RaiseEvent(args);
}
Public Shared ReadOnly ValueProperty As DependencyProperty = DependencyProperty.Register("Value", GetType(Decimal), GetType(NumericUpDown), New FrameworkPropertyMetadata(MinValue, New PropertyChangedCallback(AddressOf OnValueChanged), New CoerceValueCallback(AddressOf CoerceValue)))

Private Shared Overloads Function CoerceValue(ByVal element As DependencyObject, ByVal value As Object) As Object
	Dim newValue As Decimal = CDec(value)

	newValue = Math.Max(MinValue, Math.Min(MaxValue, newValue))

	Return newValue
End Function

Private Shared Sub OnValueChanged(ByVal obj As DependencyObject, ByVal args As DependencyPropertyChangedEventArgs)
	Dim control As NumericUpDown = CType(obj, NumericUpDown)

	Dim e As New RoutedPropertyChangedEventArgs(Of Decimal)(CDec(args.OldValue), CDec(args.NewValue), ValueChangedEvent)
	control.OnValueChanged(e)
End Sub
''' <summary>
''' Identifies the ValueChanged routed event.
''' </summary>
Public Shared ReadOnly ValueChangedEvent As RoutedEvent = EventManager.RegisterRoutedEvent("ValueChanged", RoutingStrategy.Bubble, GetType(RoutedPropertyChangedEventHandler(Of Decimal)), GetType(NumericUpDown))

''' <summary>
''' Occurs when the Value property changes.
''' </summary>
Public Custom Event ValueChanged As RoutedPropertyChangedEventHandler(Of Decimal)
	AddHandler(ByVal value As RoutedPropertyChangedEventHandler(Of Decimal))
		MyBase.AddHandler(ValueChangedEvent, value)
	End AddHandler
	RemoveHandler(ByVal value As RoutedPropertyChangedEventHandler(Of Decimal))
		MyBase.RemoveHandler(ValueChangedEvent, value)
	End RemoveHandler
	RaiseEvent(ByVal sender As System.Object, ByVal e As RoutedPropertyChangedEventArgs(Of Decimal))
	End RaiseEvent
End Event
''' <summary>
''' Raises the ValueChanged event.
''' </summary>
''' <param name="args">Arguments associated with the ValueChanged event.</param>
Protected Overridable Sub OnValueChanged(ByVal args As RoutedPropertyChangedEventArgs(Of Decimal))
	MyBase.RaiseEvent(args)
End Sub

설명

사용 하는 이벤트를 DependencyPropertyChangedEventArgs 이벤트 데이터에 대 한 클래스 및 DependencyPropertyChangedEventHandler 처리기에 대 한 메서드 구현에는 일반적으로 명명 패턴을 따릅니다 Is*Changed를 일반적으로 구현 CLR(공용 언어 런타임)common language runtime (CLR) 이벤트 없이 RoutedEvent 백업 (않은 라우트된 이벤트).The events that use the DependencyPropertyChangedEventArgs class for event data, and the DependencyPropertyChangedEventHandler method implementations for handlers, generally follow the naming pattern Is*Changed, and are generally implemented as CLR(공용 언어 런타임)common language runtime (CLR) events without RoutedEvent backing (they are not routed events). 일부 클래스 메서드를 "처리" 그렇지 않으면 처리와 같은 속성 변경을 통해 상태 변경을 보고 하는 이벤트를 공개 되지 않았을 ButtonBase.OnIsPressedChanged를 사용할 수도 DependencyPropertyChangedEventArgs 이벤트 데이터에 대 한 클래스입니다.Some class handling methods that "handle" otherwise unexposed events that report a state change through a property change, such as ButtonBase.OnIsPressedChanged, also use the DependencyPropertyChangedEventArgs class for event data.

에 대 한 시나리오 PropertyChangedCallback 속성의 속성 시스템 평가에서 제공 되는 보고서 이전 및 새 값에 대 한 인수를 사용 하는 것입니다.The scenario for PropertyChangedCallback is to use the arguments to report old and new values that come from the property system evaluation of the property. 이전 및 새 값을 처리 하는 콜백은 불필요 한 것으로 간주 되는 값이 변경에 응답 하지 않도록 선택 하는 등의 이러한 값에 따라 특수 한 처리를 선택할 수 있습니다.A callback that processes old and new values might choose special handling depending on these values, such as choosing to not respond to value changes that are deemed insignificant.

생성자

DependencyPropertyChangedEventArgs(DependencyProperty, Object, Object) DependencyPropertyChangedEventArgs(DependencyProperty, Object, Object) DependencyPropertyChangedEventArgs(DependencyProperty, Object, Object) DependencyPropertyChangedEventArgs(DependencyProperty, Object, Object)

DependencyPropertyChangedEventArgs 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the DependencyPropertyChangedEventArgs class.

속성

NewValue NewValue NewValue NewValue

변경 후의 속성 값을 가져옵니다.Gets the value of the property after the change.

OldValue OldValue OldValue OldValue

변경 전의 속성 값을 가져옵니다.Gets the value of the property before the change.

Property Property Property Property

값이 변경된 종속성 속성의 식별자를 가져옵니다.Gets the identifier for the dependency property where the value change occurred.

메서드

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

제공된 개체가 현재 DependencyPropertyChangedEventArgs에 해당하는지 여부를 확인합니다.Determines whether the provided object is equivalent to the current DependencyPropertyChangedEventArgs.

Equals(DependencyPropertyChangedEventArgs) Equals(DependencyPropertyChangedEventArgs) Equals(DependencyPropertyChangedEventArgs) Equals(DependencyPropertyChangedEventArgs)

제공된 DependencyPropertyChangedEventArgs가 현재 DependencyPropertyChangedEventArgs에 해당하는지 여부를 확인합니다.Determines whether the provided DependencyPropertyChangedEventArgs is equivalent to the current DependencyPropertyChangedEventArgs.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

DependencyPropertyChangedEventArgs의 해시 코드를 가져옵니다.Gets a hash code for this DependencyPropertyChangedEventArgs.

연산자

Equality(DependencyPropertyChangedEventArgs, DependencyPropertyChangedEventArgs) Equality(DependencyPropertyChangedEventArgs, DependencyPropertyChangedEventArgs) Equality(DependencyPropertyChangedEventArgs, DependencyPropertyChangedEventArgs) Equality(DependencyPropertyChangedEventArgs, DependencyPropertyChangedEventArgs)

지정된 두 DependencyPropertyChangedEventArgs 개체의 값이 같은지를 확인합니다.Determines whether two specified DependencyPropertyChangedEventArgs objects have the same value.

Inequality(DependencyPropertyChangedEventArgs, DependencyPropertyChangedEventArgs) Inequality(DependencyPropertyChangedEventArgs, DependencyPropertyChangedEventArgs) Inequality(DependencyPropertyChangedEventArgs, DependencyPropertyChangedEventArgs) Inequality(DependencyPropertyChangedEventArgs, DependencyPropertyChangedEventArgs)

지정된 두 DependencyPropertyChangedEventArgs 개체가 다른지 여부를 확인합니다.Determines whether two specified DependencyPropertyChangedEventArgs objects are different.

적용 대상

추가 정보