XamarinCommunityToolkit
XamarinCommunityToolkit copied to clipboard
Adding TabViewItems to a TabView via code
Description of Change
When changing the TabItems of the TabView the underlying CarouselView wasn't updated. This resulted in out of bounds exceptions if new tabs were added to an already existing filled TabView or resulted in not seeing the content when the tabs were added to an empty TabView. There also was an issue with removing tabs that would leave an empty space in the tab strip. That issue has also been fixed with this PR.
This PR is somewhat of a duplicate of PR https://github.com/xamarin/XamarinCommunityToolkit/pull/592 by @adammeaney. I stumbled upon the PR after I had created the bug fix and was looking which issues it solved. After I saw the PR I then updated the demo page to resemble that of Adams because this was requested in the conversation. I can also submit my changes to Adams PR but since that PR was stale for months I thought it'd be easier to submit mine that's all up to date with the main branche.
Bugs Fixed
- Fixes #1412
- Fixes #1219
- Fixes #559
API Changes
None
Behavioral Changes
None
PR Checklist
- [x] Has a linked Issue, and the Issue has been
approved - [ ] Has tests (if omitted, state reason in description)
- [x] Has samples (if omitted, state reason in description)
- [x] Rebased on top of main at time of PR
- [x] Changes adhere to coding standard
- [ ] Updated documentation
There is however one issue with this PR. Adding, inserting, moving and removing tabs all works. The tab strip is updated nicely, there's no overlapping or whitespaces left, but there is an issue with navigating between the tabs that I can't seem to solve. When clicking through the tabs the content part stops updating. For instance you have 5 tabs (tab1, tab2, tab3, tab4 and tab5), you navigate to tab3, the contents of tab3 will appear, you then click tab2 and the content of tab3 will stay on screen. You then have to click tab3 before you can move to another tab. It looks like CarouselView and the TabStrip aren't completely in sync but I haven't got the faintest idea what's going one.
I experienced similar things occasionally, which is one of the reasons I put off trying to finish that PR, as I just didn't have the time to look into it.
I am perfectly fine dropping my old one as one already up to date sounds nice. Just let me know.
Anybody have an idea why this behavior is happening?

@jsuarezruiz perhaps?
Any news on this?
Now that we're so close to the sunsetting of Xamarin (and therefore also Xamarin Community Toolkit) unfortunately we won't be able to take this in anymore, we're really sorry about that. Nevertheless, thank you so much for your time and effort that you have put into this PR, we really appreciate it.
Please have a look at the evolution of the Xamarin Community Toolkit, The .NET MAUI Community Toolkit. A lot of development has been going on there. Hopefully this issue was already fixed in that codebase. If not, feel free to port this over to there.
Again, thank you so much for being a contributor and Xamarin user!