I have attached a small example that shows how you can create the line and arrow shapes in the code behind. The arrow is created by copying the shape string from our diagram (drop an arrow and copy the shape). This approach can be used with other shapes as well.
The line is created by passing a custom path and adding a custom label element. This is necessary in order to be able to rotate the text.
I hope this will be useful. Let me know if you have additional questions.