Problem with collectionView that content mct: expander

227 views Asked by At

I'm working on MAUI C# application desktop. I need to put many expander in collectionView.

Here is my code in view :

 <CollectionView x:Name="question" ItemsSource="{Binding Audit.Questions}" IsVisible="false" WidthRequest="800">
     <CollectionView.ItemTemplate>
         <DataTemplate x:DataType="model:Question">
             <VerticalStackLayout>
                 <mct:Expander x:Name="questionz" IsExpanded="False">
                     <mct:Expander.Header>
                         <Grid BackgroundColor="LightGray" Padding="10" HeightRequest="100" MinimumHeightRequest="100">
                             <Label Text="{Binding Intitule}" FontSize="16" Grid.Column="0"></Label>
                             <Image  Source="exclamation_mark.png"
                                     HeightRequest="20" 
                                     TranslationX="380"
                                     ToolTipProperties.Text="{Binding RappelJuridique}"/>
                         </Grid>
                     </mct:Expander.Header>
                     <mct:Expander.Content>
                         <StackLayout 
                             MinimumHeightRequest="150">
                             <HorizontalStackLayout
                                 RadioButtonGroup.GroupName="questionAnswer"
                                 
                                 >
                                 <RadioButton GroupName="questionAnswer"
                                              x:Name="conforme"
                                              Content="Conforme"
                                              Value="1"
                                              CheckedChanged="RadioButton_CheckedChanged">
                                 </RadioButton>
                                 <RadioButton GroupName="questionAnswer"
                                              x:Name="nonConforme"
                                              Content="Non conforme"
                                              Value="0"
                                              CheckedChanged="RadioButton_CheckedChanged">
                                 </RadioButton>
                                 <RadioButton GroupName="questionAnswer"
                                              x:Name="nonFait"
                                              Content="non Fait"
                                              Value=""
                                              CheckedChanged="RadioButton_CheckedChanged">
                                 </RadioButton>
                             </HorizontalStackLayout>
                             <Entry Placeholder="Commentaire" Text="{Binding Commentaire}" HeightRequest="100" ></Entry>
                         </StackLayout>
                     </mct:Expander.Content>
                 </mct:Expander>
             </VerticalStackLayout>
         </DataTemplate>
     </CollectionView.ItemTemplate>
 </CollectionView>

The problem is that expanders have weird behavior wheb I click on the expander Header:

enter image description here

*Edit the weird behavior is when I click on a header expander in the list there is blank expander Content or I click on an expander header at the bottom of the list and I open a expander.content on the top.

It's like every thing is ok at the top of the list and the behavior change at the end. Or this kind of problem: enter image description here

Did someone can help me ?

Thanks for your time

1

There are 1 answers

0
Jessie Zhang -MSFT On

If I added more items to the CollectionView, I could find there are some issues about displaying and hiding the content of the Expander on window platform.

And I found there are some similar issues about this, you can check them here: https://github.com/dotnet/maui/issues/9023

https://github.com/dotnet/maui/issues/18078

In fact, you can also create a new issue about this problem to raise the level of the relevant issues.

Thanks for your support for Maui and feedback.