【发布时间】:2016-07-17 17:04:48
【问题描述】:
我想要一个环绕面板的动画并将其移动到左侧... 我的平台是 windows 10 visual studio 2015 通用应用程序
<Page
x:Class="App5.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App5"
xmlns:UniversalWrapPanel="using:Gregstoll"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="80*"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<UniversalWrapPanel:UniversalWrapPanel Name="mainGrid">
</UniversalWrapPanel:UniversalWrapPanel>
</Grid>
这是我的代码:
double toValue = 800;
DoubleAnimation animationSub = new DoubleAnimation()
{
Duration = TimeSpan.FromSeconds(8),
To = toValue,
BeginTime = TimeSpan.FromSeconds(3)
};
Storyboard storyBoardErrors = new Storyboard()
{
Duration = TimeSpan.FromSeconds(3 + 9),
RepeatBehavior = RepeatBehavior.Forever,
};
Storyboard.SetTarget(animationSub, mainGrid);
Storyboard.SetTargetProperty(animationSub, "(UIElement.RenderTransform).(TranslateTransform.X)");
storyBoardErrors.Children.Add(animationSub);
storyBoardErrors.Begin();
但抛出异常:
{“未检测到已安装的组件。\r\n\r\n无法解析指定对象上的 TargetProperty (UIElement.RenderTransform)。(TranslateTransform.X)。”}
未检测到已安装的组件。
无法解析 TargetProperty (UIElement.RenderTransform).(TranslateTransform.X) 上指定 对象。
我不会使用画布,因为磨损的包裹面板可以正常工作
【问题讨论】:
-
请给您发布 XAML。我很确定,您还没有设置初始转换