简体   繁体   中英

Add TransformGroup to a TransformGroup in wp7

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.

      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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM