/ Wpf

Handling property changed event for any dependency property

Here is how you can add a property changed handler for any dependency property of a UI element:

DependencyPropertyDescriptor dpd =
    DependencyPropertyDescriptor.FromProperty
        (Control.FontSizeProperty, typeof (TextBox));
 
dpd.AddValueChanged(someTextBox, SomeTextBoxFontSizeChanged);

In this example we add a property changed handler for a Control.FontSizeProperty of someTextBox.

Pavlo Glazkov

Pavlo Glazkov

Programmer. Full stack, with a focus on UI. JavaScript/TypeScript, Angular, Node.js, .NET

Read More