[BUG] Expander produces different layout of its contents based on initial value of its IsExpanded property.
StepKie opened this issue · 0 comments
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
The existing issues surfaced 2 similar issues, which however are not quite identical to the behavior I am encountering
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
When IsExpanded="False"
however, after expanding it looks like this:
it will only recompute the layout cycle once I start typing into the field
Behavior in action:
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