How to define a limit to the movement of an object in a canvas?

It's because when you do this:

        if (currentPosition.X > 1028) //this doesnt work
        {
            transform.X = clickPosition.X;
        }

You use transform, that is a different instance than the transform you use. You instanciated a new RenderTransform just before:

draggableControl.RenderTransform = new TranslateTransform(transform.X, transform.Y);

This should works:

        if (currentPosition.X > 1028)
        {
             ((TranslateTransform)draggableControl.RenderTransform).X = clickPosition.X;
        }