-
Couldn't load subscription status.
- Fork 1.9k
Fix CollectionView Header/Footer Toggle Issues on Windows and Android #32178
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
base: main
Are you sure you want to change the base?
Conversation
Windows: Ensure HeaderTemplate/FooterTemplate is cleared when set to null, and check if view is already a child before adding again. Android: Use NotifyItemInserted/NotifyItemRemoved instead of NotifyDataSetChanged for proper item management. Co-authored-by: sheiksyedm <[email protected]>
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C:\a\_work\1\s\src\Controls\samples\Controls.Sample\Pages\UserInterface\VisualStatesPage.xaml(56,34): XamlC warning XC0022: Binding could be compiled to improve runtime performance if x:DataType is specified. See https://learn.microsoft.com/dotnet/maui/fundamentals/data-binding/compiled-bindings for more information. [C:\a\_work\1\s\src\Controls\samples\Controls.Sample\Maui.Controls.Sample.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(117,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-maccatalyst]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(133,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-maccatalyst]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(14,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._footerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-maccatalyst]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(13,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._headerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-maccatalyst]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(117,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-ios]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(133,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-ios]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(13,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._headerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-ios]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(14,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._footerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-ios]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(117,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-android]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(133,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-android]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(13,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._headerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-android]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(14,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._footerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-android]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(117,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.20348.0]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(133,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.20348.0]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(14,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._footerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.20348.0]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(13,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._headerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.20348.0]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(117,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-tizen]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(133,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-tizen]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(14,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._footerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-tizen]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(13,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._headerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-tizen]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(117,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(133,44): error CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(14,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._footerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.19041.0]
C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Issues\CollectionViewHeaderFooterToggle.cs(13,18): error CS0169: The field 'CollectionViewHeaderFooterToggle._headerButton' is never used [C:\a\_work\1\s\src\Controls\tests\TestCases.HostApp\Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-windows10.0.19041.0]
24 Error(s)
Remove nullable annotations and unused fields to fix CS8632 and CS0169 errors Co-authored-by: jsuarezruiz <[email protected]>
Fixed in commit c1e27a0. Removed nullable annotations and unused fields that were causing compilation errors. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Summary
Fixed CollectionView header/footer toggle issues on Windows and Android platforms:
Windows Fix:
HeaderTemplate/FooterTemplatewhen header/footer is set to nullAndroid Fix:
NotifyDataSetChanged()with specificNotifyItemInserted()/NotifyItemRemoved()callsTest Case:
CollectionViewHeaderFooterTogglethat validates:Compilation Fixes:
object?and!) that were causing CS8632 errors_headerButtonand_footerButtonthat were causing CS0169 warningsSecurity Summary:
Original prompt
This section details on the original issue you should resolve
<issue_title>[Windows/Android] Header/Footer re-add and removal issues in CollectionView</issue_title>
<issue_description>### Description
When the header/footer are added in CollectionView, the following issues were observed on Windows and Android platforms:
Windows: When toggling the Header/Footer button to the null state and then enabling it again, the header or footer content is not added back
Android: The header and footer are not removed at runtime when set to null.
Actual Behavior:
Windows - the header or footer content is not added back.
Android retains the old header/footer even after setting them to null.
Expected Behavior:
On Windows: Header/Footer should be re-added.
On Android: Header/Footer should be removed properly when set to null.
Steps to Reproduce