I have a UserControl with a dependency property called ItemsSource. When the property is changed, I need to calculate the size of various elements. To do this, I have to access the UserControl's ActualWidth and ActualHeight properties.
The problem is, if an object is assigned to ItemsSource before a layout update has occurred, ActualWidth and ActualHeight are 0.
How can I ensure that a layout update occurs before responding to the property changed event while still allowing the property to be changed before a layout update has occurred?