PropertyChangedCallback Delegate
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the callback that is invoked when the effective property value of a dependency property changes.
public delegate void PropertyChangedCallback(DependencyObject ^ d, DependencyPropertyChangedEventArgs e);
public delegate void PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e);
type PropertyChangedCallback = delegate of DependencyObject * DependencyPropertyChangedEventArgs -> unit
Public Delegate Sub PropertyChangedCallback(d As DependencyObject, e As DependencyPropertyChangedEventArgs)
Parameters
The DependencyObject on which the property has changed value.
Event data that is issued by any event that tracks changes to the effective value of this property.
Examples
The following example registers a new dependency property, using the signature that specifies a PropertyChangedCallback. The PropertyChangedCallback is used to create a callback that changes an internal property whenever the public property changes.
public static readonly DependencyProperty AquariumGraphicProperty = DependencyProperty.Register(
"AquariumGraphic",
typeof(Uri),
typeof(AquariumObject),
new FrameworkPropertyMetadata(null,
FrameworkPropertyMetadataOptions.AffectsRender,
new PropertyChangedCallback(OnUriChanged)
)
);
Public Shared ReadOnly AquariumGraphicProperty As DependencyProperty = DependencyProperty.Register("AquariumGraphic", GetType(Uri), GetType(AquariumObject), New FrameworkPropertyMetadata(Nothing, FrameworkPropertyMetadataOptions.AffectsRender, New PropertyChangedCallback(AddressOf OnUriChanged)))
private static void OnUriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
Shape sh = (Shape) d;
sh.Fill = new ImageBrush(new BitmapImage((Uri)e.NewValue));
}
Private Shared Sub OnUriChanged(ByVal d As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
Dim sh As Shape = CType(d, Shape)
sh.Fill = New ImageBrush(New BitmapImage(CType(e.NewValue, Uri)))
End Sub
Extension Methods
GetMethodInfo(Delegate) |
Gets an object that represents the method represented by the specified delegate. |
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기