WPF dependency properties not starting on change on initialization

I use dependency properties and rely on PropertyValueChange handlers during initialization.

However, PropertyValueChange events are not fired when their property defaults are initialized, only on subsequent changes. So I need to manually trigger PropertyValueChange to force other components to get the first property value (default).

Am I misunderstanding the default values โ€‹โ€‹for default dependency properties?

Is there a better way to initialize? I cannot use static configuration in XAML for everything. I have some boolean pieces that rely on PropertyValueChange, but cannot have their character initialized from XAML.

thank

+3


source to share





All Articles