I'm working within the WPF stack, and I'd like to be able to get a MatrixTransform for any Transform. According to the link here, it doesn't seem that MatrixTransform is a base class but rather a sibling to the other Transform types. However, all normal graphics transforms should boil down to a MatrixTransform. Are there any shortcuts for this? Maybe something like hidden cast operators to take any transform to a MatrixTransform?
The base class of TranslateTransform, MatrixTransform, etc. is the abstract class Transform.
The Transform class exposes a Value property of type Matrix.  The MatrixTransform class has a constructor that takes a Matrix.  So to get the general MatrixTransform corresponding to an existing LayoutTransform of a FrameworkElement you can use code like this:
var transform = new MatrixTransform(element.LayoutTransform.Value);
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With