WPF MouseMove event fires before Loaded

130 Views Asked by At

In my window, I have a UserControl that is dynamically created. I subscribe to two events of this UserControl: Loaded and MouseMove. In Loaded I create an AdornerLayer from UserControl, and in MouseMove I use this layer to add and remove particular adorners. But strangely, MouseMove event fires before Loaded and because of it my _adornerLayer instance is null, since it is not set yet.

Why is it happening? What is the right sequence of events to get _adornerLayer ready before any mouse events?

0

There are 0 best solutions below