Reputation: 16793
I have implemented a login page and now I want to add a header image; however, image does not show up on the view.
public LoginView ()
{
InitializeComponent ();
Title= "Login";
Content = new StackLayout {
Spacing = 20,
Padding = 50,
VerticalOptions = LayoutOptions.Center,
Children = {
new Image {Source="headerImage.jpg"},
(username = new Entry { Placeholder = "Username" }),
(password = new Entry { Placeholder = "Password", IsPassword = true }),
(button=new Button { Text = "Login", TextColor = Color.White, BackgroundColor = Color.FromHex ("77D065")})
}
};
button.Clicked += Login;
}
Upvotes: 1
Views: 404
Reputation: 89082
Images need to be placed in the platform projects (iOS, Android, etc) not the shared Forms project. See Working with Images for details.
"Images can be shared across platforms with Xamarin.Forms, they can be loaded specifically for each platform, or they can be downloaded for display."
Upvotes: 2