user687554
user687554

Reputation: 11151

Animate Element in Silverlight

I have a Silverlight 4 application. This application has a Border element on top of a third-party control. I want to animate some text within this Border. If the text goes outside of the border, I want it to be hide the overflow text. My challenge is, the Border is the top-most element and it has to stay that way. Is there a way to hide the overflow text if the animation takes the text outside of the Border?

Upvotes: 0

Views: 87

Answers (1)

Sonosar
Sonosar

Reputation: 526

Register for sizechanged event of your border.

brder.SizeChanged += new SizeChangedEventHandler(brder_SizeChanged);

in handler do something like this.

void brder_SizeChanged(object sender, SizeChangedEventArgs e)
    {
        brder.Clip = new RectangleGeometry { Rect = new Rect(0, 0, brder.ActualWidth, brder.ActualHeight) };
    }

Here we give that border a Clip region, nothing can be rendered beyond that.

Upvotes: 1

Related Questions