locked
Marquee of textbox in Windows8 apps XAML

    Question

  • how to implement Marquee of textbox or images in windows 8 XAML?

    I have tried one way for marquee of textbox , using this cause marquee of text too rapid , how can i maintain its speed according to my requirement

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
         CompositionTarget.Rendering += MoveMarqueeText;
    }
    void MoveMarqueeText(object sender, object e)
    {
         Marquee.Text = Marquee.Text.Substring(1)  + Marquee.Text.Substring(0,1);
    }

    Friday, March 14, 2014 11:36 AM

Answers

  • With a Timer you can use your own update interval:

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        DispatcherTimer timer = new DispatcherTimer();
        timer.Interval = TimeSpan.FromSeconds(.25);
        timer.Tick += this.Timer_Tick;
        timer.Start();
    }
    
    private void Timer_Tick(object sender, object e)
    {
        Marquee.Text = Marquee.Text.Substring(1) + Marquee.Text.Substring(0, 1);
    }

    Friday, March 14, 2014 11:53 AM

All replies

  • With a Timer you can use your own update interval:

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        DispatcherTimer timer = new DispatcherTimer();
        timer.Interval = TimeSpan.FromSeconds(.25);
        timer.Tick += this.Timer_Tick;
        timer.Start();
    }
    
    private void Timer_Tick(object sender, object e)
    {
        Marquee.Text = Marquee.Text.Substring(1) + Marquee.Text.Substring(0, 1);
    }

    Friday, March 14, 2014 11:53 AM
  • Thanks Diederik Krols for your help.
    Monday, March 17, 2014 5:43 AM