Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Draw image at real size

$
0
0

Hi,

i've just started with Xamarin but i'm facing a problem i don't understand.

I want my app universal, so Xamarin.Forms.

I just want to display an image from resource at real size (i mean even if the image is bigger than the screen)

for now, i did :

"using Xamarin.Forms;

namespace TestXamarin
{
public class App : Application
{
public App()
{
MainPage = new MainPage();
}

    protected override void OnStart()
    {
    }

    protected override void OnSleep()
    {
    }

    protected override void OnResume()
    {
    }
}

public class BackGroundImage : Image
{
    public BackGroundImage()
    {
        Source = ImageSource.FromResource("TestXamarin.Resources.plan.jpg");
        HorizontalOptions = LayoutOptions.Center;
        VerticalOptions = LayoutOptions.Center;
        MinimumHeightRequest = MinimumWidthRequest = HeightRequest = WidthRequest = 2000;
    }
}

public class MainPage : ContentPage
{
    public MainPage()
    {
        Content = new StackLayout {Children = {new BackGroundImage()}};
    }
}

}"

i tried to wrap the image inside StackLayout, tried every horizontal/vertical Options, the image is always resize to fit the screen.

Can you explain me please ?


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>