【问题标题】:xaml code works fine but code behind class's code doesn't work :(xaml 代码工作正常,但类代码后面的代码不起作用:(
【发布时间】:2011-08-26 23:18:44
【问题描述】:

这是我的 xaml 代码

<Canvas.RenderTransform>
   <TransformGroup>
         <ScaleTransform ScaleY="-1" /> 
         <TranslateTransform Y="300" />
   </TransformGroup>
</Canvas.RenderTransform>

我在类后面的代码中做了同样的事情 但代码没有给出预期的结果。 有人可以帮我把它转换成 C# 代码吗?

问候, 兰加纳

【问题讨论】:

    标签: wpf xaml code-behind


    【解决方案1】:
    TransformGroup tg = new TransformGroup();
    tg.Children.Add(new ScaleTransform { ScaleY = -1 });
    tg.Children.Add(new TranslateTransform { Y = 300 });
    
    theCanvas.RenderTransform = tg;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-04
      • 1970-01-01
      • 2013-07-19
      • 1970-01-01
      相关资源
      最近更新 更多