1
1
1SLY22020-05-31 17:00:06
C++ / C#
1SLY2, 2020-05-31 17:00:06

Why is the image not showing on the button?

I add a .png file to the project, make it an Embedded Resource
In XAML I wrote this:

<Button x:Name="Mem_1"
                HorizontalOptions="FillAndExpand"
                VerticalOptions="FillAndExpand"
                CornerRadius="5"
                ImageSource="Res\traicer.png">
        </Button>

I tried to declare Image in code behind, and as a result, use it in XAML through the name:
Image image = new Image();

image.Source = ImageSource.FromResource("MemesCompilatiobApp.Res.traicer.png");

And, as you know, nothing helped.

Ps The method described on msdocx did not help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
relov, 2020-06-07
@relov

add the image traicer.png to the platform-specific project (android Resources\drawable), (ios Resources)
and specify in the ImageSource of the button control
<Button ImageSource="traicer.png"/>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question