Xamarin - Load Frame with image inside a ContentView

1

I want to change this Sketch so that I can draw on a photo. I downloaded the github and I am making the changes.

However, I'm not able to load an image on the screen when I set Image's Source.

private Grid BuildGrid()
    {
        return new Grid
        {
            VerticalOptions = LayoutOptions.FillAndExpand,
            HorizontalOptions = LayoutOptions.FillAndExpand,
            RowDefinitions = {
                new RowDefinition {
                    Height = GridLength.Auto
                },
                new RowDefinition {
                    Height = new GridLength (1, GridUnitType.Star)
                },
            },
            ColumnDefinitions = {
                new ColumnDefinition {
                    Width = new GridLength (100, GridUnitType.Absolute)
                },
                new ColumnDefinition {
                    Width = new GridLength (1, GridUnitType.Star)
                },
            },
            Children =
            {
              {new Label {
                    Text = "Sketch",
                    Font = Font.BoldSystemFontOfSize (50),
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    VerticalOptions = LayoutOptions.FillAndExpand
                    }, 0, 2, 0, 1},
              {BuildPalletFrame(), 0, 1},
              {new ContentView {
                   Content = BuildDrawingFrame(),
                   Padding = new Thickness(10, 0, 0, 0),
                   HorizontalOptions = LayoutOptions.FillAndExpand,
                   VerticalOptions = LayoutOptions.FillAndExpand,
              }, 1, 1}
            }
        };
    }

private Frame BuildDrawingFrame()
    {

        DrawingImage = new ImageWithTouch
        {
            VerticalOptions = LayoutOptions.FillAndExpand,
            HorizontalOptions = LayoutOptions.FillAndExpand,
            BackgroundColor = Color.Transparent,
            CurrentLineColor = Color.Black,
            Source  = "imagem.png"       // <<----------
        };

        DrawingImage.SetBinding(ImageWithTouch.CurrentLineColorProperty, "CurrentLineColor");

        var palleteFrame = new Frame
        {
            BackgroundColor = Color.Transparent,
            Padding = 5,
            HasShadow = true,
            OutlineColor = Color.Black,
            Content = DrawingImage
        };

        return palleteFrame;
    }
    
asked by anonymous 25.05.2016 / 20:07

0 answers