Error in adding footer to ListView in .Net MAUI

TD D 5 Reputation points
2023-09-08T11:19:26.8866667+00:00
HI all,
Please help as this error cites on code line: listView.Footer = footer;
 as below:
Java.Lang.IllegalStateException
  Message=The specified child already has a parent. You must call removeView() on the child's parent first.
when adding a new footer of BoxView to ListView in .Net MAUI?

in .Net MAUI project  in call:                         // Create a footer view with a transparent background
Developer technologies .NET .NET MAUI
Developer technologies .NET Other
{count} vote

2 answers

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,126 Reputation points Microsoft External Staff
    2023-09-14T06:41:45.92+00:00

    Hello,

    Thanks for your feedback.

    After testing, the width and height properties needed to be set for the _canvasView to trigger the OnCanvasViewPaintSurface event.

    Please refer to the following code snippet:

    <skia:SKCanvasView x:Name="canvasView"
                                   HeightRequest="500" WidthRequest="340"/>
    

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Brian Runck 0 Reputation points
    2024-11-06T22:11:15.1366667+00:00

    FWIW, this specific problem is a known issue: https://github.com/dotnet/maui/issues/16043

    Ignore the part about the Flyout page; the problem is the ListView on the page.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.