# Visual Basic > Xamarin >  [RESOLVED] xamarin: how to set the background image of the app ?

## bugsi

how to set the background image of the app programmatically in xamarin visual studio C# ?

----------


## Sitten Spynne

You have some Page that is being displayed at any time. it has a BackgroundImage property. Set that property, and your "app" has a background image.

----------


## bugsi

I already know how to set the BG property
I need to set it programmatically ! in order to use many different background images !
to be able to change the background image WHILE the app is running
programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically  !!!!!!! not manually !

----------


## si_the_geek

_Thread moved from the 'General Developer' forum to our brand new 'Xamarin' forum_  :Smilie:

----------


## techgnome

> I already know how to set the BG property
> I need to set it programmatically ! in order to use many different background images !
> to be able to change the background image WHILE the app is running
> programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically  !!!!!!! not manually !


Sooo.... what's the problem? form.background = image.... It's a property. You set it like any other property, no? As long as you have a valid image loaded, you should be able to just set it.


-tg

----------


## bugsi

FYI :
http://www.vbforums.com/showthread.p...27#post5217727

----------


## techgnome

No it's not a problem. It's actually not complaining about the background property... it's complaining about the form name... is your Form named "form"? No, I think not... It's named something else. Hard to tell what it is from the screen shot MSTOW-something or other... Additionally since you're in the form, you should be able to use "this" ... this.background  = ... anytime you're in a class, the this keyword will refer to that instance of that class. the property is there... you're just not accessing it correctly.

-tg

----------


## digitalShaman

this is xamarin, so it is not that easy. there are no forms in that sense and there is no filesystem where you can easily load an Image from.
so it is more complicated and not unusual for Newcomers to struggle.
i thought about knocking an example together but as my time is limited and i also Need to Research this as i have no finished code, i was not yet able to. The 70$ were also not enough to motivate me during the week. maybe on the Weekend where i might have some spare time...

----------


## techgnome

https://forums.xamarin.com/discussio...-as-background

-tg

----------


## bugsi



----------


## techgnome

We're trying to help, but we're not getting any helpt back... posting pictures of your screen with silly comments on them doesn't help... 1) I can only see half the code, so I don't know what the second half of it looks like, you've also hidden the top part of it, so I can't even tell if it's in the right spot. 2) there's a red squiggly underneath the line in question... so presumably you've screwed it up somehow... and there should be an error message to go with it... but rather than go find out what it is, you decided it would be better to make fun of the language. Instead, spend the time and just copy/paste the code here instead. Be sure to put [code][/code] tags around it... I have my suspicions  as to what's wrong, but I can't tell from a 1/4 screen shot of the code.
Maybe someone else will help.

-tg

----------


## bugsi

I placed it in the protected override void OnCreate(Bundle bundle)
        {

----------


## techgnome

I'm beginning to think you're doing something you shouldn't be doing since you seem to be reluctant to share your code so I'm out.

-tg

----------


## bugsi

@tg 
I don't have the energy to explain why the specific code is irrelevant so: 



```
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace App15
{
    [Activity(Label = "App15", MainLauncher = true, Icon = "@drawable/icon")]
    public class MainActivity : Activity
    {
        int count = 1;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.MyButton);

            button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
        }
    }
}
```

----------


## Sitten Spynne

Maybe you should take a nap and come back when you have the energy to be polite. I can see the problem clearly but I'm in too big a hurry to answer.

----------


## bugsi

solved by moti barski

----------


## bugsi

https://www.youtube.com/watch?v=Kcf-xAhg6nI

----------


## Prahlad

<Image Source="download1.jpg" Opacity="0.5" Grid.Row="0" />
                        <Image Source="horce.png" Grid.Row="0"/>
                        <StackLayout Grid.Row="0">
                            <Label Text="Uday" FontAttributes="Bold" FontSize="Large" HorizontalOptions="Center" VerticalOptions="EndAndExpand"/>
                        </StackLayout>



try it. it is work in my menubar. put to Grid.row="0"  

When you set the background image to a smaller area 

follow to code

----------


## Prahlad

```
<Image Source="download1.jpg" Opacity="0.5" Grid.Row="0" />
                        <Image Source="horce.png" Grid.Row="0"/>
                        <StackLayout Grid.Row="0">
                            <Label Text="Uday" FontAttributes="Bold" FontSize="Large" HorizontalOptions="Center" VerticalOptions="EndAndExpand"/>
                        </StackLayout>
```



it works in my menubar. 
use Grid.row="0"  

When you set the background image to a smaller area as shown in the above code

----------

