-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
CollectionView Header & Footer not showing #14557
Comments
I can reproduce this. If you look at the raw Live Visual Tree for WinUI (Not MAUIs, but the WinUI Controls that MAUI creates) you can see the header and footer for the view. There's nothing rendered in them. If I hack them with Live Property Explorer, you can force them to appear, but whatever is there when compiled doesn't work. |
facing same issue on windows after updating visual studio to Version 17.5.4 |
This seems to be happening on Android too. Checking this sample on Android, I believe something similar is happening there. |
Mine happing too |
The same is happening in my project on Windows. On Android view is generated but events are firing incorrectly when I have sublist with CollectionView. |
Hello to everyone, I ran into the same problem a while ago. The problem is, when we assign a value to the "EmptyView" property as a template, the header template in the collectionview gets corrupted. You can try it in Android environment. |
I have the same issue only in Windows. I'm using Visual Studio 17.5.5, and it was working on the previous VS version 17.5.2. |
Able to repro missing header on Windows with VS 17.5.4. Same control displays header just fine when deploying to Android, iOS, and MacCatalyst. |
As a workaround, it is possible to subscribe to Scrolled event of a CollectionView and then show/hide separately placed header/fooler views based on a scroll direction. Though I am looking forward the issue fix. :-) |
Tried https://github.com/sesitosvdx/CollectionViewHeaderFooterWindowsBug on main branch and cannot reproduce the issue on Windows.
|
@jsuarezruiz here is a pretty simple sample; notice the header and footer is visible on Android but not visible on Windows. On VS 17.5.4 |
2.3k issues + 1; |
Noticing Same Issue in Windows, Not Sure about Other Platforms. Therefore, Going with Custom Header and Footer for Now |
Same issue after updating VS to version 17.6.0 |
Same issue. |
I am having the same issue. If anyone has a work around I would love to know about it. I use a header for when loading data and I am unable to use it on windows atm. It works fine on android and ios. |
Same issue on VS 17.6.2 on Windows. No problem on Android. |
Is this only gonna be fixed in .NET 8? Have a production app that needs this... |
As a workaround it is possible to use ItemTemplateSelector and move Header/Footer to the first/last element. |
Still a problem as of 8.0-preview 6. |
Still continues on Windows |
It might be helpful to know that it does show on Windows if you use a text value. It fails when you try to use a View or a DataTemplate (using HeaderTemplate). So it looks like our ViewTemplate or the ViewToHandler converter is not working in this scenario.
|
To make the CollectionView.Header work on Windows, you need to write this code in App.xaml.cs: |
I thought the code above only works for header, but it works for footer too: CollectionViewHandler.Mapper.AppendToMapping("HeaderAndFooterFix", (_, collectionView) =>
{
collectionView.AddLogicalChild(collectionView.Header as Element);
collectionView.AddLogicalChild(collectionView.Footer as Element);
}); |
same on android, collectionview header not visible, iOS is fine |
I write this code in my app.xaml.cs,but it still not work.Can u show me code |
You may have copied it into App.xaml.cs in the main directory. You need to copy it into the Windows devices specific area in /Platforms/Windows/App.xaml.cs. Sample app with fix to help you. Look in Platforms/Windows/App.xaml.cs Or just copy past this into constructor for App.xaml.cs
|
Hmm, I tried @MegaEgorik's fix and it worked for my header but not my footer. Can work around it for now, but interesting nonetheless |
Maybe you just didn't set a HeightRequest for the footer and that's why it's not showing up. |
Entirely possible! I'm a relatively new dev - would this be an OK place to ask where I'm going wrong here implementing this workaround?
|
@MegaEgorik Thank you for the assistance. Working forwards from your example, I was able to figure out that the footer wasn't displaying because I had added an
and your workaround in App.xaml is working correctly (though I will note for MSFT's sake that it is still a workaround, and the underlying issue is not fixed) Thank you so much! |
Woohoo! Thanks for the team effort finding workarounds, friends! I assure you this is still a top priority to fix! |
I also made workaround for this issue on Windows -> #12499 |
This code works, I put it in the main App.xaml.cs (Under App.xaml) and immediately saw the header. |
The solution proposed by @MegaEgorik works, but in my case, the footer is only shown the second time you navigate to the page, the first time only the header appears. Also, the first time you navigate to the page, neither the header nor the footer have the BindingContext set, I had to set it in the OnAppearing method of the page. |
Description
When trying to add any content inside a Header/Footer to a CollectionView, it is not being displayed. Only happens in Windows. Works well for Android and iOS.
Steps to Reproduce
Create new project
Add CollectionView with a ItemsSource
Add a Header/Footer to the CollectionView
Link to public reproduction project repository
https://github.com/sesitosvdx/CollectionViewHeaderFooterWindowsBug
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows10.0.19041.0
Did you find any workaround?
#14557 (comment)
Relevant log output
No response
The text was updated successfully, but these errors were encountered: