public object ProvideValue(IServiceProvider serviceProvider) { if (string.IsNullOrWhiteSpace(Source)) { return(null); } // Do your translation lookup here, using whatever method you require var imageSource = FileImageSource.FromResource(Source, typeof(ImageResourceExtension).GetTypeInfo().Assembly); return(imageSource); }
public ImageSource ProvideValue(IServiceProvider serviceProvider) { return(FileImageSource.FromResource(Path, Assembly.GetExecutingAssembly())); }
public MainPage() { InitializeComponent(); list.ItemsSource = new List <Rider>() { new Rider() { Name = "Elias", LastName = "Pujols", Title = "Junior-Junior Developer", TravelHistory = new Travel() { Seats = 1, StreetNamePickUp = "Santa Rosa Dr, La Habana", StreetNameDestination = "Central Park, La Habana", ColorPickUp = Color.FromHex("#725EF3"), ColorDestination = Color.FromHex("#33CCCC"), TotalAmount = 34.12 }, Photo = FileImageSource.FromResource("MyRidesChallenge.Images.profile-1.png") }, new Rider() { Name = "Kara", LastName = "Dewilbow", Title = "Photographer", TravelHistory = new Travel() { Seats = 3, StreetNamePickUp = "Laguna ST, San Francisco", StreetNameDestination = "Polk ST, San Francisco", ColorPickUp = Color.FromHex("#725EF3"), ColorDestination = Color.FromHex("#33CCCC"), TotalAmount = 31.56 }, Photo = FileImageSource.FromResource("MyRidesChallenge.Images.profile-4.jpg") }, new Rider() { Name = "Mike", LastName = "Winslow", Title = "Character Design", TravelHistory = new Travel() { Seats = 2, StreetNamePickUp = "Lombard Street, San Francisco", StreetNameDestination = "Greenwitch, La Habana", ColorPickUp = Color.FromHex("#725EF3"), ColorDestination = Color.FromHex("#33CCCC"), TotalAmount = 23.4 }, Photo = FileImageSource.FromResource("MyRidesChallenge.Images.profile-2.jpeg") } }; }
public MenuPage() { //Icon = "menu.png"; Icon = FileImageSource.FromResource("menu.png"); Title = "Menu"; Padding = new Thickness(10, 20); BackgroundColor = Color.Gray; var menuItems = new List <PageModel> { new PageModel("video.png", "Videos", new VideosHomePage()), }; var listView = new ListView() { BackgroundColor = Color.Gray, SeparatorColor = Color.Gray, ItemsSource = menuItems, ItemTemplate = new DataTemplate(() => { Label titleLabel = new Label(); titleLabel.VerticalOptions = LayoutOptions.Center; titleLabel.Text = "Videos"; titleLabel.TextColor = Color.White; titleLabel.BackgroundColor = Color.Gray; titleLabel.FontSize = 15; Image _videos = new Image(); _videos.Source = "video.png"; _videos.WidthRequest = 22; _videos.HeightRequest = 22; return(new ViewCell { View = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.StartAndExpand, Padding = new Thickness(20, 0, 10, 0), Children = { _videos, titleLabel, } } }); }) }; listView.ItemTapped += (sender, e) => { ((ListView)sender).SelectedItem = null; }; listView.ItemSelected += (sender, e) => { if (e.SelectedItem == null) { return; } if (OnMenuSelect != null) { var category = (PageModel)e.SelectedItem; var categoryPage = category.PageFunction; OnMenuSelect(categoryPage); } }; Content = new StackLayout { Children = { new Label { Text = "Home", TextColor = Color.White, FontSize = 18 }, new BoxView() { Color = Color.White, WidthRequest = 200, HeightRequest = 1 }, listView, } }; }