次の図は、テキストよりも問題をよく表していると思います...
代替テキスト http://img179.imageshack.us/img179/8949/samplescrollingitems.png
それが私が必要とするものです。
<ListBox x:Name="NamesListBox" ItemsSource="{Binding}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel x:Name="ItemWrapPanel">
<WrapPanel.RenderTransform>
<TranslateTransform x:Name="ItemWrapPanelTransformation" X="0" />
</WrapPanel.RenderTransform>
<WrapPanel.Triggers>
<EventTrigger RoutedEvent="WrapPanel.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="ItemWrapPanelTransformation" Storyboard.TargetProperty="X" To="-1000" From="{Binding ElementName=ScrollingListItemsWindow, Path=Width}" Duration="0:0:9" RepeatBehavior="100" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</WrapPanel.Triggers>
</WrapPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Label Content="{Binding}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
私がしたことです。しかし、ここでは、X 値に -1000 をハード コードするのではなく、ラップ パネルの長さ/項目数に基づいてこれを決定したいと考えています。誰かがこれで私を助けることができますか??
私がリストボックスを選んだ理由は、アイテムの数がいつでも増減でき、問題により適しているからです。
他にもいい案がありましたら、こちらもお願いします。
ありがとう。