【问题标题】:Assigning the Storyboard.Target on something gives me a weird error分配 Storyboard.Target 给我一个奇怪的错误
【发布时间】:2009-08-27 02:34:40
【问题描述】:

当我编写 Storyboard.Target 时,智能感知介入并完成了工作。但是当我编译它时,我得到了一个例外。但是如果不允许,为什么intellisense会拉出来给我用呢?

<UserControl x:Class="SilverlightApplication5.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="570" d:DesignHeight="310" Width="570" Height="310">
  <Grid x:Name="LayoutRoot" Background="#003399">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="70" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="70" />
        </Grid.ColumnDefinitions>

        <Grid Grid.Column="1" >
            <Grid.RowDefinitions>
                <RowDefinition Height="50" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Grid Grid.Row="1" >
                <Image x:Name="imagenAnuncioDestacado" Source="DSC01969.JPG" Stretch="UniformToFill" />
            </Grid>            

            <Grid Grid.Row="0">
                <Rectangle x:Name="myRectangle" MouseLeftButtonDown="myRectangle_MouseLeftButtonDown" Fill="#CCFFCC" Width="200" Height="30" />
            </Grid>
        </Grid>

        <Grid Grid.Column="0" >
            <Image x:Name="imagenLeft" Source="left.PNG" Stretch="None"/>
        </Grid> 

        <Grid Grid.Column="2" >
            <Image x:Name="imagenRight" Source="right.PNG" Stretch="None"/>
        </Grid>

        <Storyboard x:Name="ShowPrice">
            <DoubleAnimationUsingKeyFrames Storyboard.Target="myRectangle" Storyboard.TargetProperty="Height" >
                <LinearDoubleKeyFrame Value="30" KeyTime="0:0:0" />
                <SplineDoubleKeyFrame KeySpline="0,0 1,0" Value="300" KeyTime="0:0:0.8" />
                <SplineDoubleKeyFrame KeySpline="0.10, 0.21 0.00, 1.0" Value="250" KeyTime="0:0:1.5" />
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </Grid>   

</UserControl>

例外:

错误 1 ​​XML 命名空间“http://schemas.microsoft.com/winfx/2006/xaml/presentation”中的类型“DoubleAnimationUsingKeyFrames”上不存在属性“Target”。 C:\Documents and Settings\Sergio\My Documents\Visual Studio 2008\Projects\SilverlightApplication5\SilverlightApplication5\MainPage.xaml 37 44 SilverlightApplication5

我想将 myStoryboard 分配给 myRectangle。我做错了什么?

【问题讨论】:

    标签: c# silverlight


    【解决方案1】:

    您想设置 Storyboard.TargetName 而不是 Storyboard.Target。

    【讨论】:

      【解决方案2】:

      试试

      Storyboard.TargetProperty="(UIElement.Height)"
      

      【讨论】:

        猜你喜欢
        • 2015-12-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-26
        • 1970-01-01
        • 1970-01-01
        • 2012-12-29
        • 2011-07-23
        相关资源
        最近更新 更多