taher chhabrawala
taher chhabrawala

Reputation: 4130

want a silverlight listbox with vertical marquee like effect

i want a silverlight listbox whose items are automatic scrollable (like a vertical marquee)

Upvotes: 4

Views: 1260

Answers (1)

Stephan
Stephan

Reputation: 5488

You might try using an ItemsControl setting the ItemsControl.ItemPanel to a StackPanel with a TranslateTransform applied on it. Then you can have a running Storyboard that adjusts the position of the Y coordinate of the Translate Transform.

EDIT: Example

<Border BorderBrush="Black" BorderThickness="2" 
        Height="100" Width="100" 
        HorizontalAlignment="Left" VerticalAlignment="Top" >
    <Border.Clip>
        <RectangleGeometry Rect="0,0,100,100" />    
    </Border.Clip>
    <ItemsControl ItemsSource="{StaticResource Collection}">
        <ItemsControl.RenderTransform>
            <TranslateTransform x:Name="Transform" />
        </ItemsControl.RenderTransform>
        <i:Interaction.Triggers>
            <i:EventTrigger>
                <ei:ControlStoryboardAction 
                    Storyboard="{StaticResource TransformMove}"/>
        </i:EventTrigger>
        </i:Interaction.Triggers>
    </ItemsControl>
</Border>

Then include this Storyboard in your control resources:

<Storyboard x:Key="TransformMove" Storyboard.TargetName="Transform" Storyboard.TargetProperty="Y">
    <DoubleAnimation From="-100" To="100" Duration="0:0:10" 
                     RepeatBehavior="Forever"/>
</Storyboard>

Upvotes: 3

Related Questions