Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What event is generate when ContentControl.Content is set?

I need to subscribe to an event for a control when ContentControl.Content is set.

Please, what event can I put in my code to set it?

I tried to use SourceUpdated and DataContextChanged, but it is not working.

like image 955
Lai32290 Avatar asked Nov 12 '22 22:11

Lai32290


1 Answers

From this webpage:

The strange approach to receiving notifications of changes in dependency properties involves dynamically creating both a dependency property and data binding. If you're writing a class that descends from DependencyObject, have access to an object that contains dependency properties, and need to be notified when one of those dependency properties changes, you can create a dependency property and a binding on the fly to give you the information you need.

ContentControl.Content is a dependency property.

like image 110
Steve Avatar answered Nov 14 '22 23:11

Steve