+1  A: 

Make the line as long as the maximum distance between the top left and bottom right corners of the parent container. This will make the line slightly longer than the container when lying flat, but fit perfectly when on a 50% slope. Let the parent crop the overflow.

Soviut
This doesn't work using RenderTransform, since the line is cropped by the layout system before a RenderTransform is applied. However, this solution DOES work perfectly with a LayoutTransform. Lengthening the line manually causes the layout system to use the code-specified length, overriding any other factors except for "Stretch." The "Stretch" property of the line needs to be set to "None" for this solution to work. Likewise, the "HorizontalAlignment" and "VerticalAlignment" properties should NOT be set to "Stretch."
Giffyguy
(The system won't allow me to upvote your answer. That's really weird...)
Giffyguy
+1  A: 

You can try scale transform before rotate transform:

<UIElement.RenderTransform>
  <TransformGroup>
    <ScaleTransform ScaleX="2.0" />
    <RotateTransform Angle="-15" />
  </TransformGroup>
</UIElement.RenderTransform>
idursun
The problem with this solution is it scales the line's thickness as well, distorting the final result.
Giffyguy
A: 

The simplest solution would be to change the X and Y values dynamically and not use a RenderTransform. Why is it that slope calculations can't be used?

moogs
I can't use slope to define the line, since I am most likely going to need to apply gradients and other eye-candies to this line later. A sloped line will react differently to a gradient's coordinate system, but a flat line will always react the same way. Since the transformation is applied after the gradient, the gradient will be rotated with the line so it will still render correctly. For further clarification, see my question regarding this: http://stackoverflow.com/questions/1412833/
Giffyguy