How do I use CompositeTransform in C #?
How can I code this XAML code in C #?
<TextBlock Text="..." RenderTransformOrigin="0.5,0.5">
<TextBlock.RenderTransform>
<CompositeTransform TranslateY="-25"/>
</TextBlock.RenderTransform>
</TextBlock>
I tried this way:
private TextBlock dots;
dots = new TextBlock();
dots.Text = "...";
dots.RenderTransformOrigin = new Point(0.5, 0.5);
(dots.RenderTransform as CompositeTransform).TranslateY = 20;
But I am getting System.NullReferenceException . I also tried this way:
var ct = (CompositeTransform)dots.RenderTransform;
ct.TranslateY = 20;
But I am getting System.InvalidCastException ( Can not cast object of type "System.Windows.Media.MatrixTransform" to input "System.Windows.Media.CompositeTransform".)
Thanks in advance!
+3
source to share