Open Meloman19 opened 1 year ago
@Meloman19 I think LayouTransform is what you need. Render transform will not have enough information about transformed bounds.
https://docs.avaloniaui.net/docs/next/reference/controls/layouttransformcontrol#more-information
@timunie Yes, LayoutTransform is works, but losing the benefit of RenderTransform.
As I can see from the source code, RenderTransform used on bounds transform. But main problem in EffectiveViewport. When panel is out of bounds, value of calculated viewport becomes empty and VirtualizedStackPanel prepare only one entity. And after change render position not raised EffectiveViewport event, because it's part of layout pass.
Instead of using an EffectiveViewport event, VirtualizingPanel can use directly parent IScrollable interface. But in this case invalidating event is missing. Or move EffectiveViewport to render pass...
I guess this is by design, but will ask @grokys first
Yeah, not sure how to fix this. You've correctly diagnosed it I think: the listbox that is being transitioned in is arranged outside the effective viewport of the containing control, so the control believes that it doesn't need to realize any items; not knowing that it's going to be transitioned into view by a render transform.
Your suggestions for solving it have a few problems:
EffectiveViewportChanged
is a layout-level event, and we can't raise it on render unless we want to run a layout pass on each render frame (we don't)I think some sort of hint where a transition can communicate to the virtualizing items control that it's being transitioned might be the best solution, but we'd need to think about how that would work. Alternatively we could just ignore render transforms when calculating the viewport for items controls.
Describe the bug VirtualizingStackPanel render only first item when move from out of bounds with rendertransform.
To Reproduce
2. On MainView.axaml insert:
3. MainView code-behind:
```cs private TranslateTransform _translate; public MainView() { InitializeComponent(); Panel.RenderTransform = _translate = new TranslateTransform { Transitions = new Avalonia.Animation.Transitions { new DoubleTransition { Duration = System.TimeSpan.FromMilliseconds(300), Property = TranslateTransform.XProperty } } }; } private void Left_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e) { _translate.X = 0; } private void Right_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e) { _translate.X = -310; } ```4. ItemsControlTheme:
```xmlExpected behavior All items from ItemsControls are rendered
Screenshots
https://github.com/AvaloniaUI/Avalonia/assets/23280622/adf44924-f775-4103-a943-c53bc3f460b5
Desktop (please complete the following information):
Additional context VirtualizingStackPanel render other items when visual is invalidated. For example, button change state from
pointerover
tonormal
or window resized etc. Also all right if use StackPanel instead VirtualizingStackPanel.