I'm trying to animate Hub.Orientation and getting an unhandled exception / catastrophic failure when moving to the "Vertical" state. The full code is below. Did I make a typo or could this be a bug? It works fine if I set the Orientation in code-behind. Thanks!
<Page
x:Class="App4.MainPage"
xmlns="http://ift.tt/w9rHWX;
xmlns:x="http://ift.tt/1idQEwn;
<StackPanel>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="OrientationStates">
<VisualState x:Name="Horizontal" />
<VisualState x:Name="Vertical">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="hub" Storyboard.TargetProperty="Orientation">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Vertical" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Button Content="Vertical" Click="OnVerticalClick" />
<Button Content="Horizontal" Click="OnHorizontalClick" />
<Hub x:Name="hub" />
</StackPanel>
</Page>
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace App4
{
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
void OnVerticalClick (object sender, RoutedEventArgs e) { VisualStateManager.GoToState(this, "Vertical", false); }
void OnHorizontalClick(object sender, RoutedEventArgs e) { VisualStateManager.GoToState(this, "Horizontal", false); }
}
}
No comments:
Post a Comment