Unwanted transition effect in control being virtualized in a virtualizing panel #17984
Replies: 3 comments 4 replies
-
I suspect there's a solution to add Either way, I can't get reproduce this behavior in either |
Beta Was this translation helpful? Give feedback.
-
Guess you need to remove the animation. I've a similar issue for ToggleSwitches |
Beta Was this translation helpful? Give feedback.
-
I do have a working solution, but I feel it is quite the hack, could have perf problems, and needs a different implementation depending on the specific virtualizing panel being used: Both TreeDataGrid and VirtualizingStackPanel (or rather ItemsControl) raises events for when a control gets "prepared" for recycling, and also when it is "cleared", removed from virtualizing. Now when a control gets "cleared" I perform a "RemoveTransitions()" on that control -- it walks over the entire visual tree of that control, removes visual.Transitions, and holds on to those transitions. When a control gets "prepared" (so it is fully prepared, all its properties are set to the new virtualized item), I perform a "RestoreTransitions()" on it, restoring all the transitions from the previous step. -- I am wondering if "recycling" of controls/visuals in the context of virtualizing could become a concept within the avalonia framework itself -- handling problems around it more efficiently and more standardized. |
Beta Was this translation helpful? Give feedback.
-
For context: I am building a virtualized treeview using
TreeDataGrid
-- but could be in any control that is virtualizing its contents.To fancy up the tree view item, I animate the chevron when the user toggles it. Imo those small animations in a UI can help the user to see what is happening.
Currently I do this in my ControlTheme for a ToggleButton, using a simple transform transition using RenderTransform:
Problem with this solution: Whenever a control using a transition effect like this gets realized by a virtualizing panel, usually when an item gets scrolled into view, this effect can be triggered and in this case the chevron will animate:
Question: Does anyone know a solution for a) keeping it simple to add small animations like this, but b) not letting it triggered in a container control that is virtualizing it?
Beta Was this translation helpful? Give feedback.
All reactions