none
Storyboard的BUG? RRS feed

  • 问题

  • 正在做一个页面停靠控件。

    在页面中添加一个Grid(W480,H800),再在Grid中添加一个UserControl(Width=120,Height=80)。

    使用TranslateTransform控制UserControl水平移动,移动为从右到左。

    当UserControl在Grid右边超出范围时(如Margin(440,100,-80,0)),超出范围的部分在移动过程和移动结束时无法显示。

    但是当移动为从左到右时能正常显示。

    也就是说,我要保证UserControl不能超过Grid的右侧(比如上文的例子,设Grid W560,UserControl在W480处停靠),才能使UserControl在右边缘停靠时能正常弹出。

    附:出问题的图和修改后的图



    2014年3月16日 8:30

答案

  • 你好,

    我用Rectangle控件在本地测试了一下,似乎没有重现你的问题。这是我的测试代码:

    <Grid x:Name="LayoutRoot" Background="Gray" Width="400" Height="800">
            <Grid.Resources>
                <Storyboard x:Name="storyBoard">
                    <DoubleAnimation Storyboard.TargetName="transTrans"
     Storyboard.TargetProperty="X"
     From="360"
     To="0"
     Duration="0:0:5"
     RepeatBehavior="Forever"
     AutoReverse="True">
                    </DoubleAnimation>
                </Storyboard>
            </Grid.Resources>
            <Rectangle Width="120" Height="80" Fill="Blue" HorizontalAlignment="Left" >
                <Rectangle.RenderTransform>
                    <TranslateTransform x:Name="transTrans" />
                </Rectangle.RenderTransform> 
            </Rectangle>
            <Button Content="Button" HorizontalAlignment="Left" Margin="192,519,0,0" VerticalAlignment="Top" Click="Button_Click"/>
        </Grid>

    希望有所帮助。


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2014年3月18日 9:31
    版主

全部回复

  • 你好,

    为了更加有效的分析问题,请附上重现代码。

    Thanks.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2014年3月17日 13:04
    版主
  • 你好,

    我用Rectangle控件在本地测试了一下,似乎没有重现你的问题。这是我的测试代码:

    <Grid x:Name="LayoutRoot" Background="Gray" Width="400" Height="800">
            <Grid.Resources>
                <Storyboard x:Name="storyBoard">
                    <DoubleAnimation Storyboard.TargetName="transTrans"
     Storyboard.TargetProperty="X"
     From="360"
     To="0"
     Duration="0:0:5"
     RepeatBehavior="Forever"
     AutoReverse="True">
                    </DoubleAnimation>
                </Storyboard>
            </Grid.Resources>
            <Rectangle Width="120" Height="80" Fill="Blue" HorizontalAlignment="Left" >
                <Rectangle.RenderTransform>
                    <TranslateTransform x:Name="transTrans" />
                </Rectangle.RenderTransform> 
            </Rectangle>
            <Button Content="Button" HorizontalAlignment="Left" Margin="192,519,0,0" VerticalAlignment="Top" Click="Button_Click"/>
        </Grid>

    希望有所帮助。


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2014年3月18日 9:31
    版主