Назначение Storyboard.Target на что-то дает мне странную ошибку - PullRequest
1 голос
/ 27 августа 2009

Когда я пишу Storyboard.Target, intellisense входит и выполняет свою работу. Но когда я его компилирую, я получаю исключение. Но если это не разрешено, почему 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 Свойство 'Target' не существует в типе DoubleAnimationUsingKeyFrames в пространстве имен XML 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'. C: \ Documents and Settings \ Sergio \ Мои документы \ Visual Studio 2008 \ Projects \ SilverlightApplication5 \ SilverlightApplication5 \ MainPage.xaml 37 44 SilverlightApplication5

Я хочу назначить myStoryboard myRectangle. Что я делаю не так?

Ответы [ 2 ]

4 голосов
/ 27 августа 2009

Вы хотите установить Storyboard.TargetName, а не Storyboard.Target.

0 голосов
/ 27 августа 2009

Попробуйте

Storyboard.TargetProperty="(UIElement.Height)"
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...