Someone on the forums was asking about how to set the mouse cursor programmatically, it reminded me about the different steps WPF uses to decide which cursor to display:

1)     When the mouse moves, we query what the cursor should be and set it to that.

a.      We raise the QueryCursor event on the element the mouse is over, which starts out assuming the cursor should be an arrow.  Elements fill in what they want the cursor to be.  This event bubbles up the tree.

i.     Anyone could respond to this event and fill in the cursor they want.

ii.     FrameworkElement fills in the cursor based on what the Cursor property is if the event is not handled or the ForceCursor property is true.

b.      We call SetCursor with the results of the QueryCursor event.

2)     You can, at any time, call SetCursor.  This sets the cursor immediately.

a.      The next mouse move could change the cursor

b.      Someone else calling SetCursor could change the cursor

c.      If someone has set an OverrideCursor, then the cursor is always set to this.

UpdateCursor() can be called to force Avalon to reevaluate what cursor to use, which can be useful if elements are moving underneath the mouse (e.g., animation).

SetCursor can be used to specify the cursor without waiting for a mouse move or UpdateCursor.  SetCursor’s effects are temporary, lasting only until the next time Avalon reconsiders which cursor to use.