Reputation: 3331
I am applying rendertransform on textbox, I want to add a TransformGroup object inside a TransformGroup Object. for doing that, I am doing somewhat like this in xaml.
<TextBox.RenderTransform>
<TransformGroup>
<MatrixTransform x:Name="previousTransform" />
<TransformGroup x:Name="currentTransform">
<ScaleTransform x:Name="scaleTransform" />
<RotateTransform x:Name="rotateTransform" />
<TranslateTransform x:Name="translateTransform" />
</TransformGroup>
</TransformGroup>
</TextBox.RenderTransform>
And it works the way I expected, now I want the same to happen inside c#, I have made a TransformGroup object and managed to add transforms to it. Now I want to add this transform group to another transformgroup object like how I did in xaml but, I dont know how to do it. Please give suggestions on the property or method I shall use to achieve it.
thanks.
Upvotes: 0
Views: 163
Reputation: 2111
var textBox = new TextBox();
var transformGroup = new TransformGroup()
{
Children = new TransformCollection()
{
new MatrixTransform(),
new TransformGroup
{
Children = new TransformCollection()
{
new ScaleTransform(),
new RotateTransform(),
new TranslateTransform()
}
}
}
};
textBox.RenderTransform = transformGroup;
Upvotes: 2