0

I'm currently writing a marquee control for WPF. The control consists of an ItemsControl, with TextBlock as the DataTemplate element of choice. The ItemsControl is the target of a Double Animation, which manipulates the Canvas.Left property.

What I would like to do is create a "circular mode", which will allow the marquee to dynamically add an item to its' tail whenever the last item has scrolled into view. That way, the marquee will never appear empty.

How can I detect when a TextBlock has "scrolled" into view (effectively become visible) as a result of the animation?

demius
  • 172
  • 1
  • 9
  • Does this need to work in Silverlight? What version? Have you considered the `PathListBox` provided in the Blend 4 SDK? – AnthonyWJones Jul 14 '10 at 07:09
  • Validate the actualwidth of the textbox against the canvas, meanwhile, why don't you try to use a list box and items control in here. That might fit in to your requirement well, i guess. Here is a similar question in stackoverflow, http://stackoverflow.com/questions/2796861/scrolling-list-items-in-wpf – sudarsanyes Jul 14 '10 at 08:22
  • can anyone help me with these? please. thanks. http://stackoverflow.com/questions/21933660/wpf-text-marquee-animation/21934028?noredirect=1#21934028 –  Feb 21 '14 at 15:17

1 Answers1

1

It might work that you check whether the ItemControl's ActualWidth property is greater than the current Canvas.Left value of your TextBlock.

To get the change event, have a look at this SO: How do I handle Canvas.Top change event in WPF?

Maybe it is useful to keep a references to the last control that was added to the tail of your marquee, so that you can remove the event handler once the control is scrolled into view and attach the event handler to the TextBlock that is then added to the tail.

It would be nice to be able to draw something for a better understanding. If anything's unclear (technically or conceptually) ask, ask, ask... :)

Community
  • 1
  • 1
Andreas
  • 3,929
  • 2
  • 25
  • 22