Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7829119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:37:37+00:00 2026-06-02T10:37:37+00:00

I have a user control which creates an animation of scrolling text and on

  • 0

I have a user control which creates an animation of scrolling text and on my main window I call it like this:

xmlns:mar="clr-namespace:WpfApplication4.AppPages"
<mar:Feed Background="DarkGray" FontSize="12" MarqueeTimeInSeconds="8" 
          Foreground="Gray" Margin="7,383,711,6" MarqueeContent="Live Feed" 
          MarqueeType="TopToBottom"></mar:Feed>

The code for the user control looks like this:

    MarqueeType _marqueeType;

    public MarqueeType MarqueeType
    {
        get { return _marqueeType; }
        set { _marqueeType = value; }
    }       

    public String MarqueeContent
    {
        set { tbmarquee.Text = value; }
    }

    private double _marqueeTimeInSeconds;

    public double MarqueeTimeInSeconds
    {
        get { return _marqueeTimeInSeconds; }
        set { _marqueeTimeInSeconds = value; }
    }

    public Feed()
    {
        InitializeComponent();
        canMain.Height = this.Height;
        canMain.Width = this.Width;
        this.Loaded += new RoutedEventHandler(Feed_Loaded);
    }

    void Feed_Loaded(object sender, RoutedEventArgs e)
    {
        StartMarqueeing(_marqueeType);
    }

    public void StartMarqueeing(MarqueeType marqueeType)
    {
            TopToBottomMarquee();
    }

    private void TopToBottomMarquee()
    {
        double width = canMain.ActualWidth - tbmarquee.ActualWidth;
        tbmarquee.Margin = new Thickness(width / 2, 0, 0, 0);
        DoubleAnimation doubleAnimation = new DoubleAnimation();
        doubleAnimation.From = -tbmarquee.ActualHeight;
        doubleAnimation.To = canMain.ActualHeight;
        doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
        doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(_marqueeTimeInSeconds));
        tbmarquee.BeginAnimation(Canvas.TopProperty, doubleAnimation);
    }

public enum MarqueeType
{
    TopToBottom
}

On the main window I set the xaml MarqueeContent="Live Feed" like so but how can I set the content in the code behind and how can I set multiple MarqueeContents?

For instance even if I was able to set the MarqueeContent from code behind and I added multiple items to it, it will no doubt just add it one after the other like the text your reading just now, I need it so each item I add has at least a paragraph spacing if that makes sense.

To give a visual idea on it you can see it here (TopDown):

http://www.codeproject.com/Articles/48267/Making-a-Simple-Marquee-Text-Control-Drip-Animatio

I need it so I can load multiple strings into it. And that each string of text added is separated by a paragraph.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T10:37:38+00:00Added an answer on June 2, 2026 at 10:37 am

    If it is only about adding multiple lines of text to one moving block, you could simply add line breaks between the lines:

    textBlock.Text = "A line of text.\n\nAnother line of text.";
    

    Or you can do the same with Inlines:

    textBlock.Inlines.Add(new Run("A line of text."));
    textBlock.Inlines.Add(new LineBreak());
    textBlock.Inlines.Add(new LineBreak());
    textBlock.Inlines.Add(new Run("Another line of text."));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows form which hosts a custom User Control. This User Control
I have a custom user control in XAML that creates a ItemsControl which ItemsPanel
So I have a user control within a window that creates a new dialog
I have a user control which is hosted in a content placeholder. This is
I have a window that have a user control. This user control has a
I have created a user control (link) which has a label and a button.
I have created an Address user control which is as follow: <%@ Control Language=C#
I have created a user control (CheckedDirTree) that exposes a CheckedFolder property which in
I have created a wpf application into which I have added a user control
I have a user control which displays the currently logged in user's name. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.