2013-10-23 12 views
0

我在文本框上應用了rendertransform,我想在TransformGroup對象內添加一個TransformGroup對象。 爲此,我在xaml中做了一些這樣的工作。將變換組添加到wp7中的變換組中

    <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> 

和它的作品我預想的方式,現在我想C#裏面發生的一樣,我已經做了的TransformGroup對象,並設法轉換到它。現在我想將這個變換組添加到另一個transformgroup對象,就像我在xaml中做的一樣,但是,我不知道如何去做。 請提供關於我將用來實現它的財產或方法的建議。

謝謝。

回答

2
 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; 
+0

它工作正常。 –