SIGN UP MEMBER LOGIN:    
ARTICLE

Scroll Banner or Text in Silverlight

Posted by Rahul Kumar Saxena Articles | WPF with C# May 17, 2010
In this article I am going to show how we can scroll text or banner in silverlight.
Reader Level:

In this article I am going to show how we can scroll text or banner in silverlight. This is my XAML code...

<UserControl x:Class="ScrollingBannerInSilverlight.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

    <Canvas xmlns="http://schemas.microsoft.com/client/2007"

   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

        <Canvas.Triggers>

            <EventTrigger RoutedEvent="Canvas.Loaded" >

                <BeginStoryboard>

                    <Storyboard x:Name="animation" Storyboard.TargetProperty="(Canvas.Left)" RepeatBehavior="Forever" >

                        <DoubleAnimation Storyboard.TargetName="ScrollText" From="0" To="-820" Duration="0:0:10"  />

                        <DoubleAnimation Storyboard.TargetName="ScrollText1" From="820" To="0" Duration="0:0:10"  />

                    </Storyboard>

                </BeginStoryboard>

            </EventTrigger>

        </Canvas.Triggers>

        <TextBlock x:Name="ScrollText" FontFamily="Verdana" FontSize="36" Foreground="Blue"  Text="Welcome to silverlight word." />

        <TextBlock x:Name="ScrollText1" FontFamily="Verdana" FontSize="36" Foreground="Blue" Text="Welcome to silverlight word." />

    </Canvas>

</UserControl>

 

When we run the application then.

 Scrolling Banne rImage1.JPG

Image 1.

Scrolling BannerImage2.JPG 

Image 2.

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Nevron Gauge for SharePoint
Become a Sponsor