Presentation is loading. Please wait.

Presentation is loading. Please wait.

Displaying Local Images

Similar presentations


Presentation on theme: "Displaying Local Images"— Presentation transcript:

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

3

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 } };

5

6

7

8

9 Compare with Displaying Images using XAML Markup

10

11

12

13

14

15 https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/


Download ppt "Displaying Local Images"

Similar presentations


Ads by Google