Wpf XAML DoubleAnimation未完全呈现项目

Wpf XAML DoubleAnimation未完全呈现项目,wpf,xaml,rss,itemscontrol,doubleanimation,Wpf,Xaml,Rss,Itemscontrol,Doubleanimation,我正在尝试使用XAML创建一个滚动新闻提要,但是由于提要被切断,我遇到了一些问题。现在我只是在我的XmlDataProvider中使用一些假新闻标题,但它们将来自RSS提要 <Window.Resources> <XmlDataProvider x:Key="NewsFeed" XPath="/rss/Channel/Item"> <x:XData> <rss xmlns="">

我正在尝试使用XAML创建一个滚动新闻提要,但是由于提要被切断,我遇到了一些问题。现在我只是在我的XmlDataProvider中使用一些假新闻标题,但它们将来自RSS提要

<Window.Resources>
    <XmlDataProvider x:Key="NewsFeed" XPath="/rss/Channel/Item">
        <x:XData>
            <rss xmlns="">
                <Channel>
                    <Item>
                        <Headline>Cash-Strapped Oklahoma To Conduct Executions By Hammering Squad</Headline>
                    </Item>
                    <Item>
                        <Headline>PetSmart Manager Does Morning Sweep Of Enclosures For Dead Ones Before Opening Doors For Day</Headline>
                    </Item>
                    <Item>
                        <Headline>Lovestruck Arabian Princess Begs Father To Spare John Kerry’s Life</Headline>
                    </Item>
                    <Item>
                        <Headline>Frantic Joe Biden Searching Dog Shelter For Bo Look-Alike</Headline>
                    </Item>
                    <Item>
                        <Headline>Pope Tweets Picture Of Self With God</Headline>
                    </Item>
                    <Item>
                        <Headline>Wes Welker Fielding Offers From Numerous Concussion Researchers</Headline>
                    </Item>
                </Channel>
            </rss>
        </x:XData>
    </XmlDataProvider>
</Window.Resources>

资金紧张的俄克拉荷马州将由重击队执行死刑
PetSmart Manager在打开一天的门之前,每天早上都会扫描机柜中的死物
坠入爱河的阿拉伯公主恳求父亲饶了约翰·克里一命
疯狂的乔·拜登在狗庇护所寻找长得像波的狗
教皇在推特上向上帝展示自我
韦斯·韦尔克·菲尔丁(Wes Welker Fielding)提供了众多脑震荡研究人员的建议
下面是带有包含动画文本的项控件的网格

    <Grid Background="Gray">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="45" />
        <ColumnDefinition Width="1*" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="1*" />
    </Grid.RowDefinitions>
    <Label Content="RSS" FontSize="16" Margin="10,0,0,0" FontStyle="Italic" Foreground="White" />
    <ItemsControl Grid.Row="0" Grid.Column="1" Margin="10,0,10,0" Height="35" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Padding="0" DataContext="{Binding Source={StaticResource NewsFeed}, XPath=/rss/Channel/Item}" ItemsSource="{Binding XPath=//Headline}">
        <!-- -->
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <VirtualizingStackPanel Orientation="Horizontal" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>

        <ItemsControl.Template>
            <ControlTemplate TargetType="ItemsControl">
                <Border BorderBrush="CadetBlue" BorderThickness="2" Height="Auto" Padding="0" HorizontalAlignment="Stretch" VerticalAlignment="Center" ClipToBounds="True">
                    <StackPanel ClipToBounds="True">
                        <StackPanel.RenderTransform>
                            <TranslateTransform x:Name="translate" />
                        </StackPanel.RenderTransform>
                        <StackPanel.Triggers>
                            <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                                <BeginStoryboard>
                                    <Storyboard RepeatBehavior="Forever">
                                        <DoubleAnimation From="1000" To="-1000" Storyboard.TargetName="translate" Storyboard.TargetProperty="X" Duration="0:0:25" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </StackPanel.Triggers>
                        <ItemsPresenter />
                    </StackPanel>
                </Border>
            </ControlTemplate>
        </ItemsControl.Template>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal" Background="CadetBlue" Width="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="Auto" ClipToBounds="True" Margin="3">
                    <TextBlock VerticalAlignment="Center" Foreground="Black" Text="//" Margin="0,0,8,0" ClipToBounds="True" />
                    <TextBlock VerticalAlignment="Center" Foreground="LightYellow" Text="{Binding Path=InnerText}" Margin="0,0,8,0" ClipToBounds="True" />
                </StackPanel>
            </DataTemplate>
        </ItemsControl.ItemTemplate>

        <ItemsControl.ItemContainerStyle>
            <Style>
                <Setter Property="Control.Margin" Value="5" />
                <Setter Property="Control.VerticalAlignment" Value="Stretch" />
            </Style>
        </ItemsControl.ItemContainerStyle>
    </ItemsControl>
</Grid>

动画正在运行,但正在删除第三个标题。现在它显示了6条标题中的3条。为什么没有呈现所有的标题


类似的方法应该会奏效:

<ItemsControl.Template>
    <ControlTemplate TargetType="ItemsControl">
        <Border BorderBrush="CadetBlue" BorderThickness="2" Height="Auto"
                HorizontalAlignment="Stretch" VerticalAlignment="Center"
                ClipToBounds="True">
            <ItemsPresenter />
        </Border>
    </ControlTemplate>
</ItemsControl.Template>

<ItemsControl.ItemsPanel>
    <ItemsPanelTemplate>
        <StackPanel Orientation="Horizontal">
            <StackPanel.RenderTransform>
                <TranslateTransform />
            </StackPanel.RenderTransform>
            <StackPanel.Triggers>
                <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                    <BeginStoryboard>
                        <Storyboard RepeatBehavior="Forever">
                            <DoubleAnimation 
                                Storyboard.TargetProperty="RenderTransform.X"
                                From="1000" To="-1000" Duration="0:0:25" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </StackPanel.Triggers>
        </StackPanel>
    </ItemsPanelTemplate>
</ItemsControl.ItemsPanel>