AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.11k stars 2.26k forks source link

Expander with PageSlide transition broken #17400

Closed aguahombre closed 3 weeks ago

aguahombre commented 4 weeks ago

Describe the bug

Using an expander with PageSlide ContentTransition slides the content in the wrong direction when closing the expander.

It looks like commit f13ece461b43306c8f9c2680662e649c265b1e07 removed the !forward on Expander.cs line 107

Before...
                if (IsExpanded)
                {
                    ContentTransition.Start(null, visualContent, forward);
                }
                else
                {
                    ContentTransition.Start(visualContent, null, !forward);
                }
After...
                if (IsExpanded)
                {
                    await ContentTransition.Start(null, visualContent, forward, _lastTransitionCts.Token);
                }
                else
                {
                    await ContentTransition.Start(visualContent, null, forward, _lastTransitionCts.Token);
                }

To Reproduce

    <Style Selector="Expander">
      <Setter Property="ContentTransition">
        <Setter.Value>
          <PageSlide Orientation="Horizontal" Duration="0:0:0.25"/>
        </Setter.Value>
      </Setter>
      <Setter Property="ExpandDirection" Value="Right"/>
   </Style>

Expected behavior

The expander content should slide right when opening the expander and back left when closing the expander.

Avalonia version

11.2

OS

Windows

Additional context

No response

timunie commented 4 weeks ago

@aguahombre yeah I think the ! Was removed by accident. Can you file a PR to add it back?

/cc @maxkatz6

aguahombre commented 4 weeks ago

If I get time next week, I can give the PR a go

Coloryr commented 3 weeks ago

Let me make one pr.