Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Expander produces different layout of its contents based on initial value of its IsExpanded property. #2363

Open
2 tasks done
StepKie opened this issue Nov 28, 2024 · 0 comments
Labels
bug Something isn't working unverified

Comments

@StepKie
Copy link

StepKie commented Nov 28, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

The existing issues surfaced 2 similar issues, which however are not quite identical to the behavior I am encountering

Related issues: #1557, #1656

I have an expander (simplified code with inline example content instead of viewmodel bindings)

<toolkit:Expander IsExpanded="True">
  <toolkit:Expander.Header>
    <StackLayout Orientation="Horizontal">
      <Label HorizontalOptions="Center" VerticalTextAlignment="Center" Text="Click to Expand" />
    </StackLayout>
  </toolkit:Expander.Header>
  <toolkit:Expander.Content>
  <CollectionView>
    <CollectionView.ItemsSource>
      <x:Array Type="{x:Type x:String}">
        <x:String>One</x:String>
        <x:String>Two</x:String>
        <x:String>Three</x:String>
        <x:String>Four</x:String>
        <x:String>Five</x:String>
        <x:String>Six</x:String>
        <x:String>Seven</x:String>
        <x:String>Eight</x:String>
      </x:Array>
    </CollectionView.ItemsSource>
    <CollectionView.ItemTemplate>
      <DataTemplate>
          <Entry Text="{Binding .}" />
      </DataTemplate>
    </CollectionView.ItemTemplate>
  </CollectionView>
</toolkit:Expander.Content>
</toolkit:Expander>

The issue is the behavior is different based on the initial state. When IsExpanded="True", then everything looks fine, aka this is the behavior I want and would expect

Image

When IsExpanded="False" however, after expanding it looks like this:

Image

it will only recompute the layout cycle once I start typing into the field

Image

Behavior in action:

Image

is there any way to ensure that the layout behavior is not dependent on the initial state of the IsExpanded property?

Expected Behavior

The visual result should be identical when reaching the expanded state, regardless of whether it started in the expanded state or not.

Steps To Reproduce

Create new sample app
Add code provided above

Link to public reproduction project repository

tbd

Environment

- .NET MAUI CommunityToolkit: 9.0.3
- OS: Windows 11
- .NET MAUI: 8.0.91

Anything else?

No response

@StepKie StepKie added bug Something isn't working unverified labels Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unverified
Projects
None yet
Development

No branches or pull requests

1 participant