dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.21k stars 1.74k forks source link

[regression/8.0.0-preview.7.8842] borders ItemTemplate doesn't show if it includes a border (Using PanCardView) #17252

Open Zack-G-I-T opened 1 year ago

Zack-G-I-T commented 1 year ago

Description

The ItemTemplate shows blank in PanCardView - CoverFlowView when a border is used in the data template in .NET 8. Using a normal CarouselView it works completely fine. This all works on .NET 7.

I have attatched the sample repo with frame replaced by border in PanCardViewSample.Views.CoverFlowSampleXamlView. It also has a CarouselView above the CoverFlowView to compare.

https://github.com/Zack-G-I-T/MAUI.NET8.BorderIssue

Steps to Reproduce

  1. Get Repo
  2. Run and click CoverFlow button
  3. See carousel working fine, but coverflow showing blank.

Link to public reproduction project repository

https://github.com/Zack-G-I-T/MAUI.NET8.BorderIssue

Version with bug

8.0.0-preview.7.8842

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.0-preview.6.8686

Affected platforms

Android

Affected platform versions

Android 13

Did you find any workaround?

No

Relevant log output

No response

samhouts commented 1 year ago

@Zack-G-I-T I'm not able to get the repository to build. Do you happen to have a smaller sample?

ghost commented 1 year ago

Hi @Zack-G-I-T. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

Zack-G-I-T commented 1 year ago

Hi @samhouts, sorry about that I have simplified the repo so should work fine now

samhouts commented 1 year ago

Confirmed that this regressed between 8.0.0-preview.6.8686 and 8.0.0-preview.7.8842. https://github.com/dotnet/maui/pull/16046 seems sus. Could also have been https://github.com/dotnet/maui/pull/15458.

jstedfast commented 1 year ago

Haven't investigated very far, but seems like the PanCardView is painting over the Border.

If I copy the Border to the StackLayout, then it draws just like the Frame.

jstedfast commented 1 year ago

If I replace the custom card view with CollectionView, the Border renders correctly.

I think the issue is with the custom control and not Border.

Zack-G-I-T commented 1 year ago

@jstedfast thanks for looking into this. Why would it work with a border in .NET 7 but not .NET 8? Has something changed with the way borders render?

jstedfast commented 1 year ago

A lot of stuff has changed :-\

I have no idea.

jstedfast commented 1 year ago

I wonder if the PanCardView was compensating for bugs that were in Border in previous releases and that compensation now is breaking things.

I don't know, just something to consider.

gabsamples6 commented 1 year ago

@jstedfast @Zack-G-I-T I was monitoring this issue as well and the guy beat me to it to raise the issue , Its was one of those .net 8 critical issues we are facing -

the problem we have now is that the maintainer of this fantastic nuget is not longer interested in fixing things.

.Net 8 broke a lot of things that worked in .net 7 and now we are left in a very bad place..

We would have totally moved away from this nuget if the microsoft carouselview etcc was not that buggy.. It might be that the panCardView was compensating but I personally think that all they did was just apply the xamarin compatability to it and publish for Maui.

@jstedfast is there anything you can help us with on this one or that is it?

jstedfast commented 1 year ago

If you just need CarouselView bugs to be fixed, then:

Are the bugs reported to the Issue tracker? Which bugs are they? Have you chimed in on those bug reports to increase priority for them?

That seems like the best way forward.

gabsamples6 commented 1 year ago

@jstedfast firstly thank you for replying is very much appreciated - to be honest we lost a bit of faith with the all CarouselView/CollectionView - its been a rollcoaster since XF and continued to be bad with Maui and at times discoraging with issues logged but never pursued.

Same with border - Border -Clipping of the images that has been a bug in .net 7 since day 1 and reported tons of times for only to be fixed in .net 8... involving us using all sorts of workaround...

We really need the border to fullfil its promise and work with controls same way as it did in .net 7 in terms of control visibility . if this issue is not going to be investigated any further than , we have a big issue and we just hope we can fudge it with a frame.

jstedfast commented 1 year ago

I'll reopen this. Maybe someone with knowledge of ItemTemplates and how they are supposed to work can take a look at this.

gabsamples6 commented 1 year ago

Thanks for reopening - @jsuarezruiz would be grateful if have any suggestions on the border and why the pancard view stopped showing in .net 8 and works in .net 7 , the author of this plugin @AndreiMisiukevich has no longer the time to look into this. This is clearly a .net 8 issue that is affecting us big time and will affect anyone using this nuget in net 8.

many thanks

AndreiMisiukevich commented 1 year ago

@gabsamples6 I assume it can be related to the control PanCardView is inherited from (AbsoluteLayout). Maybe it uses a "wrong" class. As far as I remember, there were a few AbsoluteLayout classes for some reason.

But yeah, unfortunately, I don't have much time for maintenance now. Also, I want to note that everything worked pretty well (and stable) in XF, which makes me think there is nothing to "fix" in PanCardView (unless adding some workaround or "crutches"). I admit that maybe something should be updated/changed in PanCardView, though, since MAUI has a different approach for rendering.

gabsamples6 commented 1 year ago

@AndreiMisiukevich thanks for replying .. I think we are stuck on this one .. and to be honest I dont see it being fixed.. I had a look at the code but not sure what should be changed. More people as soon as they adopt .net 8 will encounter this issue.. any chance of a look?

thanks

AndreiMisiukevich commented 1 year ago

@gabsamples6 just out of curiosity


<StackLayout>
    <AbsoluteLayout>
        <ContentView 
            AbsoluteLayout.LayoutFlags="All"
            AbsoluteLayout.LayoutBounds="0, 0, 1, 1">
            <Border HeightRequest="200"
               VerticalOptions="Center"
               HorizontalOptions="Fill"
               Padding="0"  Background="pink">
                <Label Text="test" Background="red" VerticalOptions="Center"/>
            </Border>
        </ContentView>
    </AbsoluteLayout>
</StackLayout>

Does this code work fine for you?

gabsamples6 commented 1 year ago

@AndreiMisiukevich hi below is what I see image

gabsamples6 commented 1 year ago

@PureWeen hi what does SR1 means in terms of due date? We cannot ship the app as it plays an important part in many pages. Many thanks

jstedfast commented 1 year ago

@gabsamples6 is it possible to switch to Frame instead of Border in the template(s) since Frame apparently works?

gabsamples6 commented 1 year ago

@jstedfast hi - we can probably switch to frame - but we will have a big problem as we created many pages where we have

And we are talking many pages across different apps...

so all that design agreed with the UI - UX team will go out of the window and we already did some demo to some clients..

What is the issue really -

I remember that when we used frame we had other issues (honestly forgot where they were ) - I moved everthing to border.. little did I know all the border issues..

Is there any chance at all to have a deeper look into it. Is it something with absoluteLayout the issue?

I will be honest - I am trying to ditch all possible nuget packages and I would love to remove this one too but there are no alternatives out there and writing one is not an option right now as all our deadlines with Maui went out of the window..

AndreiMisiukevich commented 1 year ago

@gabsamples6 TBH, I don't think it's a good idea to use the preview .NET version for production.

gabsamples6 commented 1 year ago

@AndreiMisiukevich we are not going to production with a preview version, but we are getting ready for when it goes stable in november , but this is one issue that is preventing us from going live as your control just wont render anymore under a border..

We are in a very difficult position as Maui .net 7 is full of issues - memory leaks -keyaboard overlapping etcc.. that stopped us going to production and we were hoping that we could with .net 8 but they have broken interfaces and controls like yours and now we are in a terrible position.

AndreiMisiukevich commented 1 year ago

@gabsamples6 yeah, I see. Sorry to hear that. I can propose you to try to debug my control (or maybe even pull the source code and adjust as you need).

Zack-G-I-T commented 1 year ago

As @gabsamples6 said, the frame has become obsolete in maui and doesnt have many of the functions the border has. I have tried to debug the pancard nuget but cannot find what the difference is between frame and border. Surely this is a Microsoft issue as a border should be able to be used in a datatemplate just like it was in .NET 7.

AndreiMisiukevich commented 1 year ago

@gabsamples6 just out of curiosity

<StackLayout>
    <AbsoluteLayout>
        <ContentView 
            AbsoluteLayout.LayoutFlags="All"
            AbsoluteLayout.LayoutBounds="0, 0, 1, 1">
            <Border HeightRequest="200"
               VerticalOptions="Center"
               HorizontalOptions="Fill"
               Padding="0"  Background="pink">
                <Label Text="test" Background="red" VerticalOptions="Center"/>
            </Border>
        </ContentView>
    </AbsoluteLayout>
</StackLayout>

Does this code work fine for you?

I wonder if this code still works if you try to wrap AbsoluteLayout with Border. (Because essentially it's what PanCardView is)

Zack-G-I-T commented 1 year ago

Some strange behaviour occurs - the border gets drawn exactly halfway up. (I made it 500 height and each of the little rectangles is 100). I dont think this helps our situation though as Frame behaves in the exact same way.

image image

Strangely if you wrap the border in a stack layout it appears correctly.

image image

AndreiMisiukevich commented 1 year ago

@Zack-G-I-T does this workaround help with PanCardView? (Wrapping an a Border with ContentView or AbsoluteLayout)

Zack-G-I-T commented 1 year ago

@AndreiMisiukevich No unfortunately it doesn't. Ive tried wrapping the Border in a stack layout, absolute layout, an outer frame... Even if you put a border deeper as a child of something else it just doesn't show which seems like there is an internal exception in the pancard project. But after downloading the code and debugging with all exceptions on there is no error at all.

image image

(Swap frame with border) image image

gabsamples6 commented 1 year ago

@jstedfast can you suggest anything? any of the people on the team have any suggestions or a quick look at this?

jstedfast commented 1 year ago

Unfortunately, this bug has me scratching my head in bewilderment. Sorry.

jstedfast commented 1 year ago

Apparently PanCardView is using a Xamarin.Forms compatibility API that is not working correctly in this case.

https://github.com/AndreiMisiukevich/CardView.MAUI/issues/16

AndreiMisiukevich commented 1 year ago

Hey folks, please feel free to submit PR with fix. I'll be happy to review, merge and publish it to nuget as soon as possible

PureWeen commented 1 year ago

I'm going to move this issue to he backlog for now. I realize this regressed at some point against MAUI, but this is an area we've marked obsolete for some time. Addressing behavior changes in the obsoleted compatibility layer isn't something we're going to be able to prioritize over other issues

ghost commented 1 year ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

gabsamples6 commented 1 year ago

@PureWeen Even though I totally get where you are coming from , specially with basic core issues in maui still not working you dont see this as priority as you are all in firefighting mode.. however this has left is in a very difficult position as we can no longer use a border with this control, and frame we were told that was obsolete...

We were sold the idea that to ease the migration you could have compatability on , and now you are saying that that layer is obsolete, so all these nugets outthere is a re-write! On that one @AndreiMisiukevich asked you if you could give some pointers why handlers are not working and hence why he had to use renderers..

There is no control out there that does what this control does and carousel control /collection view is a no starter for obvious reasons..

We all know what backlogs means... I just hope you can give us some pointers on why handlers are not working there..

many thanks

AndreiMisiukevich commented 1 year ago

Hey folks, I apologize for PanCardView.MAUI not working correctly.

I wanted to make a quick port from Xamarin to Maui. I don't have enough time to rewrite renderers to handlers (even though there is not much code).

I tried to use "right" renderers a few times, and every time, I failed. But I encourage the community to submit a PR with fix/refactoring. I will be happy to review/test and merge as quickly as I can.

Best Regards

Zhanglirong-Winnie commented 2 months ago

This issue has been verified using Visual Studio 17.12.0 Preview 1.0 (8.0.80 & 8.0.72 & 8.0.3 & 8.0.0-preview.7.8842). Can repro on Android platform. Verified working fine on 8.0.0-preview.6.8686.