WPF 새내기 문제 :그리드가 회전하지 않습니다
visualstatemanager에서 스토리 보드의 눈금을 회전하려고하지만 아무 반응이 없습니다. 나는 아래의 간단한 샘플로 프로젝트를 보냈다. 그리고 여전히 운이 없다. 불투명도 애니메이션은 제대로 작동하지만 격자는 회전하지 않습니다. 내가 도대체 뭘 잘못하고있는 겁니까?
감사
XAML :
Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid x:Name="gridMain">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="vsgOrientation">
<VisualState x:Name="vsHorizontal"/>
<VisualState x:Name="vsVertical">
<Storyboard>
<DoubleAnimation To="90" Duration="0:0:0" Storyboard.TargetName ="gridTest" Storyboard.TargetProperty="(Grid.RenderTransform).(RotateTransform.Angle)"/>
<DoubleAnimation To="0.25" Duration="0:0:0" Storyboard.TargetName ="gridTest" Storyboard.TargetProperty="Opacity"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid x:Name="gridTest" HorizontalAlignment="Left" Height="33" Margin="159,108,0,0" VerticalAlignment="Top" Width="101" Background="#FFB85E5E"/>
</Grid>
그리고 뒤에 코드 : 그것의 모습에서
Class MainWindow
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
VisualStateManager.GoToElementState(gridMain, vsVertical.Name, False)
End Sub
최종 클래스
감사합니다. 나는 같은 장소로 안내하는 또 다른 게시물을 발견했습니다. 불행히도 아무런 차이가 없습니다. – 2stroke
RenderTransform이 실제로 없기 때문에 +2stroke가 TargetProperty를 Storyboard.TargetProperty = "(UIElement.RenderTransform). (CompositeTransform.Rotation)"로 변경하고 RotateTransform을 CompositeTransform으로 변경하고 작동해야합니다. 그렇지 않으면 나중에 테스트합니다. 방금 쳐다 보는 총. –
@ChrisW. Silverlight에는 CompositeTransform이 있지만 WPF에는 없습니다. '(UIElement.RenderTransform). (RotateTransform.Angle)'이하가되면 RenderTransform.Angle이 올바른 속성 경로가됩니다. – Clemens