0

I use the below code to show image on a from.

<ContentPage>
        <ContentPage.Content>
                <Grid>
                      // Row definitions here
                      // Column definitions here
                      <Image 
                            Grid.Column="0" 
                            Grid.Row="0"
                            x:Name="myStoryPage"
                            Grid.ColumnSpan="3">                
                      </Image>

                      <!-- Next, previous buttons here -->

                      <skiaforms:SKCanvasView x:Name="canvasView"
                                PaintSurface="canvasView_PaintSurface"
                                Grid.Row="3"
                                Grid.Column="0"
                                Grid.ColumnSpan="3"
                                AbsoluteLayout.LayoutBounds="10, 0, 5, 65"/>

                </Grid>
        </ContentPage.Content>
</ContentPage>

Now I need to highlight an area in the image using SkiaSharp. I could do drawing a line under the grid using the SKCanvasView. But I want to draw over the image.

I thought to use use AbsoluteLayout but as my page is a ContentPage, I could not use the AbsoluteLayout outside of the content.

If I could use AbsoluteLayout, I can dynamically position it using C# in code behind.

Rauf
  • 12,326
  • 20
  • 77
  • 126
  • place the canvas on TOP of the Image, then draw on the canvas with a transparent background – Jason Feb 19 '21 at 13:32
  • If you don't mind me asking, can you just share the code. Is it like ...> – Rauf Feb 19 '21 at 18:26
  • place a SKCanvasView in the same Grid cell as the image, so the Canvas is on Top of the Image. If the Canvas has a transparent background, anything drawn on it will appear to be overlaid on the image – Jason Feb 19 '21 at 19:08
  • @Jason, Great, it worked. Please post as answer, I will accept it. – Rauf Feb 20 '21 at 05:20

0 Answers0