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 7738631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:18:59+00:00 2026-06-01T08:18:59+00:00

I’ve got a custom (and getting complex) TabControl . It’s a gathering of many

  • 0

I’ve got a custom (and getting complex) TabControl. It’s a gathering of many sources, plus my own wanted features. In it is a custom Panel to show the headers of the TabControl. Its features are to compress the size of the TabItems until they reached their minimum, and then activates scrolling features (in the Panel, again). There is also another custom panel to hold a single button, that renders on the right of the TabItems (it’s a “new tab” button).

It all works great, until I try to animate the scrolling.

Here are some relevant snippets :

In the CustomTabPanel (C#, overriding Panel and implementing IScrollInfo):

private readonly TranslateTransform _translateTransform = new TranslateTransform();

public void LineLeft()
{
    FirstVisibleIndex++;

    var offset = HorizontalOffset + _childRects[0].Width;
    if (offset < 0 || _viewPort.Width >= _extent.Width)
        offset = 0;
    else
    {
        if (offset + _viewPort.Width > _extent.Width)
            offset = _extent.Width - _viewPort.Width;
    }

    _offset.X = offset;
    if (_scrollOwner != null)
        _scrollOwner.InvalidateScrollInfo();

    //Animate the new offset
    var aScrollAnimation = new DoubleAnimation(_translateTransform.X, -offset,
                                           new Duration(this.AnimationTimeSpan), FillBehavior.HoldEnd) { AccelerationRatio = 0.5, DecelerationRatio = 0.5 };
    aScrollAnimation.Completed += ScrollAnimationCompleted;

    _translateTransform.BeginAnimation(TranslateTransform.XProperty, aScrollAnimation , HandoffBehavior.SnapshotAndReplace);

    //End of animation

    // These lines are the only ones needed if we remove the animation
    //_translateTransform.X = -offset;
    //InvalidateMeasure();
}


void ScrollAnimationCompleted(object sender, EventArgs e)
{
    InvalidateMeasure();
}

the _translateTransform is initialized in the constructor :

    base.RenderTransform = _translateTransform;

Again, everything is fine if I remove the animation part and just replace it with the commented out lines at the end.

I must also point out that the problem is NOT with the animation itself. That part works out well. The problem is about when I remove some tab items : all the layout then screws up. The TranslateTransformation seems to hold on some wrong value, or something.

Thanks in advance.

  • 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-01T08:19:00+00:00Added an answer on June 1, 2026 at 8:19 am

    Well. As it’s often the case, I kept working on the thing, and… answered myself.

    Could still be useful for other people, so here was the catch. In the line :

    var aScrollAnimation = new DoubleAnimation(_translateTransform.X, -offset, new Duration(this.AnimationTimeSpan), FillBehavior.HoldEnd)
        { AccelerationRatio = 0.5, DecelerationRatio = 0.5 };
    

    the FillBehavior should have been FillBehavior.Stop.

    As easy as that!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I have just tried to save a simple *.rtf file with some websites and
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

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.