Since shapes on a canvas are UIElements you can listen and respond to Pointer events. When the clicks the item you can flag it as selected, and when they click elsewhere you can unflag it.
See
Quickstart: Pointers for an intro to pointer events and Quickstart: Touch input for an intro to touch and manipulation events, including code
snippets for dragging a rectangle around the screen.
--Rob