I'm trying to create custom classes of object which can be drawn on Canvas
.
For example:
I wish to create a class called CustomRectangle
which will allow me to create a simple rectangle from given X
and Y
location values, along with Width
and Height
and will have a Label
inside it. This CustomRectangle
. I also wish to register this class to Mouse Events
such as MouseMove
in order to move the Rectangle
on the Canvas
while clicking and dragging it.
I found several implementations of classes which derive from UIElement
but those solutions don't allow me register the newly created object to mouse events.
Can such a thing be done? If I wish to create my own private library of "Custom Shapes"?