Silverlight 如何防止控件被其列表框父项&x27;动画中的边界?

Silverlight 如何防止控件被其列表框父项&x27;动画中的边界?,silverlight,windows-phone-7.1,windows-phone-7,Silverlight,Windows Phone 7.1,Windows Phone 7,我在列表框中的StackPanel中有一个图像图标,我想使用一个translate行为来设置它的动画,这样它就可以“反弹” 但当它向上移动时,图像的顶部会在其列表框父对象的边界内被剪裁 是否有一个属性可以调整,使其在设置动画时与边界重叠 谢谢 你需要让你的父母Grid更大 尝试将StackPanel的Margin设置为22 使用工作示例更新 <phone:PhoneApplicationPage xmlns="http://schemas.microsoft.com/winfx

我在列表框中的StackPanel中有一个图像图标,我想使用一个translate行为来设置它的动画,这样它就可以“反弹”


但当它向上移动时,图像的顶部会在其列表框父对象的边界内被剪裁

是否有一个属性可以调整,使其在设置动画时与边界重叠


谢谢

你需要让你的父母
Grid
更大

尝试将
StackPanel
Margin
设置为22

使用工作示例更新

<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    x:Class="outofboundaryissue1.MainPage"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="False">
    <phone:PhoneApplicationPage.Resources>
        <Storyboard x:Name="m_activateIdentityStoryboard" RepeatBehavior="Forever" AutoReverse="True">  
            <DoubleAnimationUsingKeyFrames   
                Storyboard.TargetProperty=  
                      "(UIElement.RenderTransform).(CompositeTransform.TranslateY)"   
                Storyboard.TargetName="image">  
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>  
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-22"/>  
                <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="22"/>  
            </DoubleAnimationUsingKeyFrames>  
        </Storyboard>
    </phone:PhoneApplicationPage.Resources>

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Background="#FF2D0C0C">
            <StackPanel d:LayoutOverrides="Height">
                <Image x:Name="image" Source="/Koala.jpg" RenderTransformOrigin="0.5,0.5" Width="100" Height="75">
                    <Image.RenderTransform>
                        <CompositeTransform/>
                    </Image.RenderTransform>
                </Image>
            </StackPanel>
        </Grid>
    </Grid>
</phone:PhoneApplicationPage>


Hmmmm。。。那会弄乱布局。还有别的办法吗?你能再发一些代码吗?我写了一些代码来实现你描述中的内容,看起来它工作得很好。对不起,我的错,我没有提到堆栈面板也在列表框中,似乎是列表框的边界将其剪裁。在文章中添加了完整的示例代码。您的列表框中只有一个图像还是仅用于演示?仅用于演示。列表框中的其他项没有显示出相同的问题,因为它们位于下方——剪切似乎只发生在列表框边界,而不是项目的stackpanel边界。
<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    x:Class="outofboundaryissue1.MainPage"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="False">
    <phone:PhoneApplicationPage.Resources>
        <Storyboard x:Name="m_activateIdentityStoryboard" RepeatBehavior="Forever" AutoReverse="True">  
            <DoubleAnimationUsingKeyFrames   
                Storyboard.TargetProperty=  
                      "(UIElement.RenderTransform).(CompositeTransform.TranslateY)"   
                Storyboard.TargetName="image">  
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>  
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-22"/>  
                <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="22"/>  
            </DoubleAnimationUsingKeyFrames>  
        </Storyboard>
    </phone:PhoneApplicationPage.Resources>

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Background="#FF2D0C0C">
            <StackPanel d:LayoutOverrides="Height">
                <Image x:Name="image" Source="/Koala.jpg" RenderTransformOrigin="0.5,0.5" Width="100" Height="75">
                    <Image.RenderTransform>
                        <CompositeTransform/>
                    </Image.RenderTransform>
                </Image>
            </StackPanel>
        </Grid>
    </Grid>
</phone:PhoneApplicationPage>