[RESOLVED] xamarin: how to set the background image of the app ?
how to set the background image of the app programmatically in xamarin visual studio C# ?
Re: xamarin: how to set the background image of the app ?
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.
Re: xamarin: how to set the background image of the app ?
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 !
Re: xamarin: how to set the background image of the app ?
Thread moved from the 'General Developer' forum to our brand new 'Xamarin' forum :)
Re: xamarin: how to set the background image of the app ?
Quote:
Originally Posted by
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 !
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
Re: xamarin: how to set the background image of the app ?
Re: xamarin: how to set the background image of the app ?
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
Re: xamarin: how to set the background image of the app ?
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...
Re: xamarin: how to set the background image of the app ?
Re: xamarin: how to set the background image of the app ?
Re: xamarin: how to set the background image of the app ?
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
Re: xamarin: how to set the background image of the app ?
I placed it in the protected override void OnCreate(Bundle bundle)
{
Re: xamarin: how to set the background image of the app ?
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
Re: xamarin: how to set the background image of the app ?
@tg
I don't have the energy to explain why the specific code is irrelevant so:
Code:
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++); };
}
}
}
Re: xamarin: how to set the background image of the app ?
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.
Re: xamarin: how to set the background image of the app ?
Re: [RESOLVED] xamarin: how to set the background image of the app ?
Re: [RESOLVED] xamarin: how to set the background image of the app ?
<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
Re: [RESOLVED] xamarin: how to set the background image of the app ?
HTML Code:
<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