Wpf 如何更改曲面应用程序的应用程序方向

Wpf 如何更改曲面应用程序的应用程序方向,wpf,pixelsense,Wpf,Pixelsense,当用户按下按钮时,我需要在运行时将surface应用程序的UI旋转180度。我该怎么做 只需在最上面的面板上以180度的角度涂上一层(我想你甚至可以在实际的曲面窗口上涂,如果你愿意的话) <s:SurfaceWindow x:Class="SurfaceApplication1.SurfaceWindow1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://s

当用户按下按钮时,我需要在运行时将surface应用程序的UI旋转180度。我该怎么做

只需在最上面的面板上以180度的角度涂上一层(我想你甚至可以在实际的曲面窗口上涂,如果你愿意的话)

<s:SurfaceWindow x:Class="SurfaceApplication1.SurfaceWindow1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="http://schemas.microsoft.com/surface/2008"
    Title="SurfaceApplication1">
  <Grid>
    <Grid.LayoutTransform>
      <RotateTransform x:Name="mainOrientation"/>
    </Grid.LayoutTransform>
    <s:SurfaceButton Click="btn_Click" Content="Click to rotate" />   
    ... other content here ...
   </Grid>
</s:SurfaceWindow>
作为一个相关主题,您还可以收听surface的,以了解用户何时更改了您应用程序的一侧。一个好的做法是在发生这种情况时将应用程序翻转到正确的一侧。

只需在最上面的面板上应用一个180度的角度(我想你甚至可以在实际的曲面窗口上这样做)

<s:SurfaceWindow x:Class="SurfaceApplication1.SurfaceWindow1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="http://schemas.microsoft.com/surface/2008"
    Title="SurfaceApplication1">
  <Grid>
    <Grid.LayoutTransform>
      <RotateTransform x:Name="mainOrientation"/>
    </Grid.LayoutTransform>
    <s:SurfaceButton Click="btn_Click" Content="Click to rotate" />   
    ... other content here ...
   </Grid>
</s:SurfaceWindow>

作为一个相关主题,您还可以收听surface的,以了解用户何时更改了您应用程序的一侧。一个好的做法是在发生这种情况时将应用程序翻转到正确的一侧。

@Isak,太棒了!谢谢你的回答@伊萨克,太棒了!谢谢你的回答!