Download presentation
Presentation is loading. Please wait.
1
Displaying Local Images
Lecture 4 Displaying Local Images C# vs XAML
2
Adding an Image to Android App Project
right-click drawable -> Add -> Existing Item -> your-pic
4
using System; using Xamarin.Forms; namespace NowApp { public class ButtonPage : ContentPage public ButtonPage() Button button = new Button Text = "Now", BorderWidth = 1, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; button.Clicked += OnButtonClicked; Button picbtn = new Button Text = "Mickey", picbtn.Clicked += OnPicbtnClicked; this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); this.Content = new StackLayout Children = button, picbtn } void OnButtonClicked(object sender, EventArgs e) Navigation.PushAsync(new anotherPage()); void OnPicbtnClicked(object sender, EventArgs e) Navigation.PushAsync(new imagePage()); using System; using Xamarin.Forms; namespace NowApp { public class imagePage : ContentPage public imagePage() Image imgDisp = new Image(); imgDisp.Source = "Mickey_Mouse.jpg"; Content = new StackLayout Children = imgDisp } };
9
Compare with Displaying Images using XAML Markup
15
https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.