public override View GetSampleContent(Context context) { context1 = context; //carousel carousel = new SfCarousel(context1); List <SfCarouselItem> tempCollection = new List <SfCarouselItem>(); for (int i = 1; i <= 7; i++) { SfCarouselItem carouselItem = new SfCarouselItem(context1); carouselItem.ImageName = "images" + i; tempCollection.Add(carouselItem); } carousel.DataSource = tempCollection; carousel.SelectedIndex = 3; carousel.ScaleOffset = 0.8f; if (context1.Resources.DisplayMetrics.Density > 1.5) { carousel.ItemHeight = Convert.ToInt32(240 * context1.Resources.DisplayMetrics.Density); carousel.ItemWidth = Convert.ToInt32(170 * context1.Resources.DisplayMetrics.Density); } carousel.LayoutParameters = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); return(carousel); }
public View GetItemView(SfCarousel carousel, int index) { double density1; int width1, height1; List <int> imageID = new List <int>(); width1 = myComtext.Resources.DisplayMetrics.WidthPixels; height1 = myComtext.Resources.DisplayMetrics.HeightPixels; density1 = myComtext.Resources.DisplayMetrics.Density; FrameLayout linear = new FrameLayout(myComtext); linear.SetBackgroundColor(Color.White); linear.LayoutParameters = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, (int)(110 * density1)); var item = myList[index]; TextView Srcimage = new TextView(myComtext); Srcimage.Text = (myList[index] as CarouselPropertyClass).Unicode; Srcimage.Typeface = Typeface.CreateFromAsset(myComtext.Assets, "CarouselIcon.ttf"); Srcimage.SetTextColor((myList[index] as CarouselPropertyClass).ItemColor); Srcimage.TextSize = 40; Srcimage.SetWidth((int)(110 * density1)); Srcimage.SetHeight((int)(110 * density1)); Srcimage.TextAlignment = TextAlignment.Center; Srcimage.Gravity = GravityFlags.Center; linear.AddView(Srcimage); return(linear); }
public MainPage() { InitializeComponent(); SfCarousel carousel = new SfCarousel() { ItemWidth = 170, ItemHeight = 250 }; ObservableCollection <SfCarouselItem> collectionOfItems = new ObservableCollection <SfCarouselItem>(); collectionOfItems.Add(new SfCarouselItem() { ImageName = "area.png", ClassId = "1" }); collectionOfItems.Add(new SfCarouselItem() { ImageName = "donut.png", ClassId = "2" }); collectionOfItems.Add(new SfCarouselItem() { ImageName = "pie.png", ClassId = "3" }); collectionOfItems.Add(new SfCarouselItem() { ImageName = "series.png", ClassId = "4" }); collectionOfItems.Add(new SfCarouselItem() { ImageName = "step.png", ClassId = "5" }); carousel.ItemsSource = collectionOfItems; this.Content = new StackLayout() { Children = { carousel, Activity, ListaGenerica } }; carousel.SelectedIndex = 1; List <string> Numeros = new List <string>(); carousel.SelectionChanged += async(object sender, SelectionChangedEventArgs e) => { var obj = (SfCarouselItem)e.SelectedItem; string Id = obj.ClassId; string Nombre = obj.ImageName; ListaGenerica.ItemsSource = null; await Task.Yield(); Activity.IsRunning = true; await Task.Delay(3000); ListaGenerica.ItemsSource = elementoslista; Activity.IsRunning = false; Numeros.Add(Id); var c = Numeros[Numeros.Count - 1]; await DisplayAlert("Ok", $"{Id},{Nombre}, {c.ToString()}", "OK"); }; }
public override Android.Views.View GetItemView(SfCarousel p0, int p1) { FrameLayout frameLayout = new FrameLayout(_context); SfCarouselItem sfCarouselItem = new SfCarouselItem(_context); ImageView imageView = new ImageView(_context); imageView.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(p0.ItemWidth, p0.ItemHeight); imageView.SetImageResource(_PicturesList[p1]); imageView.SetScaleType(ImageView.ScaleType.FitXy); frameLayout.AddView(imageView); return(frameLayout); }
public ParkingAdminPage() { InitializeComponent(); SfCarousel carousel = new SfCarousel() { ItemWidth = 170, ItemHeight = 250 }; ObservableCollection <SfCarouselItem> collectionOfItems = new ObservableCollection <SfCarouselItem>(); collectionOfItems.Add(new SfCarouselItem() { ItemContent = new Label() { Text = "ItemContent2", BackgroundColor = Color.FromHex("#7E6E6B"), FontSize = 12 } }); collectionOfItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "icon.png", Aspect = Aspect.AspectFit } }); collectionOfItems.Add(new SfCarouselItem() { ItemContent = new Button() { Text = "ItemContent1", TextColor = Color.White, BackgroundColor = Color.FromHex("#7E6E6B"), FontSize = 12 } }); collectionOfItems.Add(new SfCarouselItem() { ImageName = "icon.png" }); //collectionOfItems.Add(new SfCarouselItem() { ImageName = "icon.png" }); //collectionOfItems.Add(new SfCarouselItem() { ImageName = "icon.png" }); //collectionOfItems.Add(new SfCarouselItem() { ImageName = "icon.png" }); //collectionOfItems.Add(new SfCarouselItem() { ImageName = "icon.png" }); //collectionOfItems.Add(new SfCarouselItem() { ImageName = "icon.png" }); carousel.ItemsSource = collectionOfItems; this.Content = carousel; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); carousel = new SfCarousel(this); carousel.ItemWidth = 700; carousel.ItemHeight = 700; carousel.Adapter = new CarouselViewAdapter(this); carouselList = new List <SfCarouselItem>(); carouselList.Add(new SfCarouselItem(this)); carouselList.Add(new SfCarouselItem(this)); carouselList.Add(new SfCarouselItem(this)); carouselList.Add(new SfCarouselItem(this)); carousel.DataSource = carouselList; SetContentView(carousel); }
public Carousel_Mobile() { viewModePicker = new UIPickerView(); PickerModel viewModel = new PickerModel(viewModeList); viewModePicker.Model = viewModel; viewModeLabel = new UILabel(); viewButton = new UIButton(); this.OptionView = new UIView(); NSMutableArray <SfCarouselItem> carouselItemCollection = new NSMutableArray <SfCarouselItem> (); carousel = new SfCarousel(); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { carousel.Frame = new CGRect(150, 150, 300, 650); } else { carousel.Frame = new CGRect(0, 0, 300, 430); } carousel.ItemHeight = 300; carousel.ItemWidth = 150; carousel.SelectedItemOffset = 20; for (int i = 1; i <= 7; i++) { carouselItem = new SfCarouselItem(); carouselItem.ImageName = "image" + i + ".png"; carouselItemCollection.Add(carouselItem); } carousel.DataSource = carouselItemCollection; carousel.SelectedIndex = 2; this.AddSubview(carousel); offsetLabel = new UILabel(); scaleOffsetLabel = new UILabel(); rotationAngleLabel = new UILabel(); offsetLabel.Text = "OFFSET"; offsetLabel.TextColor = UIColor.Black; offsetLabel.TextAlignment = UITextAlignment.Left; offsetLabel.Font = UIFont.FromName("Helvetica", 14f); scaleOffsetLabel.Text = "SCALE OFFSET"; scaleOffsetLabel.TextColor = UIColor.Black; scaleOffsetLabel.TextAlignment = UITextAlignment.Left; scaleOffsetLabel.Font = UIFont.FromName("Helvetica", 14f); rotationAngleLabel.Text = "ROTATION ANGLE"; rotationAngleLabel.TextColor = UIColor.Black; rotationAngleLabel.TextAlignment = UITextAlignment.Left; rotationAngleLabel.Font = UIFont.FromName("Helvetica", 14f); offsetTextfield = new UITextView(); offsetTextfield.TextAlignment = UITextAlignment.Center; offsetTextfield.Layer.BorderColor = UIColor.Black.CGColor; offsetTextfield.KeyboardType = UIKeyboardType.NumberPad; offsetTextfield.BackgroundColor = UIColor.FromRGB(246, 246, 246); offsetTextfield.Text = "60"; offsetTextfield.Changed += (object sender, EventArgs e) => { if (offsetTextfield.Text.Length > 0) { carousel.Offset = nfloat.Parse(offsetTextfield.Text); } else { carousel.Offset = 60; } }; scaleOffsetTextfield = new UITextView(); scaleOffsetTextfield.TextAlignment = UITextAlignment.Center; scaleOffsetTextfield.Layer.BorderColor = UIColor.Black.CGColor; scaleOffsetTextfield.BackgroundColor = UIColor.FromRGB(246, 246, 246); scaleOffsetTextfield.KeyboardType = UIKeyboardType.NumberPad; scaleOffsetTextfield.Text = "0.8"; scaleOffsetTextfield.Changed += (object sender, EventArgs e) => { if (scaleOffsetTextfield.Text.Length > 0) { carousel.ScaleOffset = nfloat.Parse(scaleOffsetTextfield.Text); } else { carousel.ScaleOffset = (nfloat)0.8; } }; rotationAngleTextfield = new UITextView(); rotationAngleTextfield.TextAlignment = UITextAlignment.Center; rotationAngleTextfield.Layer.BorderColor = UIColor.Black.CGColor; rotationAngleTextfield.BackgroundColor = UIColor.FromRGB(246, 246, 246); rotationAngleTextfield.KeyboardType = UIKeyboardType.NumberPad; rotationAngleTextfield.Text = "45"; rotationAngleTextfield.Changed += (object sender, EventArgs e) => { if (rotationAngleTextfield.Text.Length > 0) { carousel.RotationAngle = int.Parse(rotationAngleTextfield.Text); } else { carousel.RotationAngle = 45; } }; //viewModeLabel viewModeLabel.Text = "VIEW MODE"; viewModeLabel.TextColor = UIColor.Black; viewModeLabel.TextAlignment = UITextAlignment.Left; //viewButton viewButton.SetTitle("Default", UIControlState.Normal); viewButton.SetTitleColor(UIColor.Black, UIControlState.Normal); viewButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; viewButton.Layer.CornerRadius = 8; viewButton.Layer.BorderWidth = 2; viewButton.TouchUpInside += ShowviewModePicker; viewButton.Layer.BorderColor = UIColor.FromRGB(246, 246, 246).CGColor; //viewDoneButton viewDoneButton.SetTitle("Done\t", UIControlState.Normal); viewDoneButton.SetTitleColor(UIColor.Black, UIControlState.Normal); viewDoneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right; viewDoneButton.TouchUpInside += HidePicker; viewDoneButton.Hidden = true; viewDoneButton.BackgroundColor = UIColor.FromRGB(246, 246, 246); viewModel.PickerChanged += viewSelectedIndexChanged; viewModePicker.ShowSelectionIndicator = true; viewModePicker.Hidden = true; //viewModePicker.BackgroundColor = UIColor.Gray; }
void AddGridView() { InitializeChildGrid(); mainGrid = new FrameLayout(sampleContext); mainGrid.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); mainGrid.AddView(childGrid); maps = new SfMaps(sampleContext); maps.ZoomLevel = 4; maps.MinZoom = 4; maps.MaxZoom = 10; maps.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent); layer = new ImageryLayer(); layer.GeoCoordinates = new PointF(27.1751f, 78.0421f); PopulationMarker marker1 = new PopulationMarker(sampleContext); marker1.Latitude = 20.6843f; marker1.Longitude = -88.5678f; layer.Markers.Add(marker1); PopulationMarker marker2 = new PopulationMarker(sampleContext); marker2.Latitude = -13.1631f; marker2.Longitude = -72.5450f; layer.Markers.Add(marker2); PopulationMarker marker3 = new PopulationMarker(sampleContext); marker3.Latitude = -22.9519f; marker3.Longitude = -43.2106f; layer.Markers.Add(marker3); PopulationMarker marker4 = new PopulationMarker(sampleContext); marker4.Latitude = 41.8902; marker4.Longitude = 12.4922; layer.Markers.Add(marker4); PopulationMarker marker5 = new PopulationMarker(sampleContext); marker5.Latitude = 30.3285; marker5.Longitude = 35.4444; layer.Markers.Add(marker5); PopulationMarker marker6 = new PopulationMarker(sampleContext); marker6.Latitude = 27.1751; marker6.Longitude = 78.0421; layer.Markers.Add(marker6); PopulationMarker marker7 = new PopulationMarker(sampleContext); marker7.Latitude = 40.4319; marker7.Longitude = 116.5704; layer.Markers.Add(marker7); maps.Adapter = new MarkerAdapter(sampleContext); maps.Layers.Add(layer); mainGrid.AddView(maps); mainGrid.SetClipChildren(false); List <int> arrayList = new List <int>(); arrayList.Add(Resource.Drawable.Mexico); arrayList.Add(Resource.Drawable.Peru); arrayList.Add(Resource.Drawable.Christ); arrayList.Add(Resource.Drawable.Colosseum); arrayList.Add(Resource.Drawable.Petra); arrayList.Add(Resource.Drawable.TajMahal); arrayList.Add(Resource.Drawable.China_wall); List <string> descriptionList = new List <string>(); descriptionList.Add("Mayan ruins on Mexico's Yucatan Peninsula. It was one of the largest Maya cities, thriving from around A.D. 600 to 1200."); descriptionList.Add("An inca citadel built in the mid-1400s. It was not widely known until the early 20th century."); descriptionList.Add("An enormous statue of Jesus Christ with open arms. A symbol of Christianity across the world, the statue has also become a cultural icon of both Rio de Janeiro and Brazil."); descriptionList.Add("Built between A.D. 70 and 80. It is one of the most popular touristattractions in Europe."); descriptionList.Add("It is a historic and archaeological city in southern Jordan. Petra lies around Jabal Al-Madbah in a basin surrounded by mountains which form the eastern flank of the Arabah valley that runs from the Dead Sea to the Gulf of Aqaba."); descriptionList.Add("It is an ivory-white marble mausoleum on the southern bank of the river Yamuna in the Indian city of Agra."); descriptionList.Add("The Great Wall of China is a series of fortifications that were built across the historical northern borders of ancient Chinese states and Imperial China as protection against various nomadic groups from the Eurasian Steppe."); List <string> headerList = new List <string>(); headerList.Add("Chichen Itza, Mexico"); headerList.Add("Machu Picchu, Peru"); headerList.Add("Chirst the Redeemer, Brazil"); headerList.Add("Colosseum, Rome"); headerList.Add("Petra, Jordan"); headerList.Add("Taj Mahal, India"); headerList.Add("Great wall of China, China"); DisplayMetrics displayMetrics = sampleContext.Resources.DisplayMetrics; float screenWidth = displayMetrics.WidthPixels; float screenHeight = displayMetrics.HeightPixels; var density = displayMetrics.Density; LinearLayout layout = new LinearLayout(sampleContext); layout.Orientation = Orientation.Horizontal; layout.SetPadding(0, 0, 0, 10); layout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); layout.SetVerticalGravity(GravityFlags.Bottom); var itemWidth = screenWidth * 0.7; SfCarousel carousel = new SfCarousel(sampleContext); carousel.RotationAngle = 0; carousel.ItemWidth = (int)itemWidth; carousel.ItemHeight = (int)(110 * sampleContext.Resources.DisplayMetrics.Density); carousel.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, carousel.ItemHeight); carousel.SelectedIndex = 5; carousel.SelectedItemOffset = (int)(carousel.ItemWidth / 2) - (int)(carouselGap * density); List <SfCarouselItem> dataSource = new List <SfCarouselItem>(); for (int i = 0; i <= 6; i++) { LinearLayout linearLayout = new LinearLayout(sampleContext); linearLayout.SetBackgroundColor(Color.White); linearLayout.Orientation = Orientation.Horizontal; linearLayout.SetBackgroundResource((Resource.Drawable.carousel_corner_radius)); linearLayout.LayoutParameters = new Android.Views.ViewGroup.LayoutParams((int)itemWidth, (int)carousel.ItemHeight); var width = (int)(0.6f * itemWidth); LinearLayout layout1 = new LinearLayout(sampleContext); layout1.Orientation = Orientation.Vertical; layout1.LayoutParameters = new Android.Views.ViewGroup.LayoutParams((int)width, (int)carousel.ItemHeight); layout1.SetPadding(15, 15, 15, 15); TextView textView = new TextView(sampleContext); textView.Text = headerList[i]; textView.SetTypeface(Typeface.Default, TypefaceStyle.Bold); textView.TextAlignment = TextAlignment.TextStart; textView.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width - 30, ViewGroup.LayoutParams.WrapContent); layout1.AddView(textView); textView = new TextView(sampleContext); textView.Text = descriptionList[i]; textView.SetMaxLines(3); textView.Ellipsize = Android.Text.TextUtils.TruncateAt.End; textView.TextAlignment = TextAlignment.TextStart; textView.SetPadding(0, 10, 0, 0); textView.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width - 30, ViewGroup.LayoutParams.WrapContent); layout1.AddView(textView); linearLayout.AddView(layout1); SfCarouselItem sfCarouselItem = new SfCarouselItem(sampleContext); width = (int)(0.4f * itemWidth); LinearLayout layout2 = new LinearLayout(sampleContext); layout2.SetPadding(10, 15, 15, 15); layout2.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width, carousel.ItemHeight); ImageView imageView = new ImageView(sampleContext); imageView.SetBackgroundResource((Resource.Drawable.carousel_corner_radius)); imageView.SetImageResource(arrayList[i]); imageView.SetScaleType(ImageView.ScaleType.FitXy); imageView.ClipToOutline = true; layout2.AddView(imageView); linearLayout.AddView(layout2); sfCarouselItem.ContentView = linearLayout; dataSource.Add(sfCarouselItem); } carousel.DataSource = dataSource; carousel.SelectionChanged += Carousel_SelectionChanged; layout.AddView(carousel); mainGrid.AddView(layout); LinearLayout linear = new LinearLayout(sampleContext); linear.Orientation = Orientation.Horizontal; linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); linear.SetHorizontalGravity(GravityFlags.End); linear.SetVerticalGravity(GravityFlags.Bottom); TextView textView1 = new TextView(sampleContext); textView1.Text = "©"; textView1.SetBackgroundColor(Color.White); textView1.SetTextColor(Color.Black); textView1.SetPadding(2, 2, 2, 2); linear.AddView(textView1); TextView textView2 = new TextView(sampleContext); textView2.Text = "OpenStreetMap contributors."; textView2.SetTextColor(Color.DeepSkyBlue); textView2.SetPadding(0, 2, 3, 2); textView2.SetBackgroundColor(Color.White); textView2.Clickable = true; textView2.Click += TextView2_Click; linear.AddView(textView2); mainGrid.AddView(linear); }
public Fruit() { InitializeComponent(); SfCarousel flash = new SfCarousel() { ItemHeight = 490, ItemWidth = 300 }; ObservableCollection <SfCarouselItem> allItems = new ObservableCollection <SfCarouselItem>(); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "banana.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "ananas.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "apple.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "cherry.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "grapes.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "kiwi.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "lemon.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "peach.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "plum.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "straw.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "warm.png", Aspect = Aspect.AspectFit } }); flash.ItemsSource = allItems; this.Content = flash; }
/// <summary> /// Initializes a new instance of the <see cref="T:SampleBrowser.LoadMoreSample"/> class. /// </summary> public LoadMoreSample() { carouselScrollview = new UIScrollView(); alertWindow = new UIAlertView(); alertWindow.AddButton("OK"); carouselViewModel = new CarouselViewModel(); LoadMoreLayout = new UIView(); LoadMoreLayout.BackgroundColor = UIColor.FromRGB(249, 249, 249); carouselScrollview.BackgroundColor = UIColor.FromRGB(249, 249, 249); applicationLabel = new UILabel(); applicationLabel.Text = "Application"; applicationLabel.TextColor = UIColor.FromRGBA(nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse("0.9764705882352941")); applicationLabel.Font = UIFont.FromName("Helvetica", 18f); applicationCarousel = new SfCarousel(); applicationCarousel.ItemWidth = 150; applicationCarousel.ItemHeight = 150; applicationCarousel.AllowLoadMore = true; applicationCarousel.LoadMoreItemsCount = 4; UILabel loadmore2 = new UILabel() { TextColor = UIColor.Black, Text = "Load More...", Font = UIFont.FromName("Helvetica-Bold", 13f), TextAlignment = UITextAlignment.Center }; loadmore2.Frame = new CoreGraphics.CGRect(12, 61, 150, 17); UIView loadView2 = new UIView(); loadView2.BackgroundColor = UIColor.FromRGB(255, 255, 255); loadView2.AddSubview(loadmore2); applicationCarousel.LoadMoreView = loadView2; applicationCarousel.ViewMode = SFCarouselViewMode.SFCarouselViewModeLinear; applicationCarousel.ItemsSource = carouselViewModel.ApplicationCollection; applicationCarousel.ItemSpacing = 15; applicationCarousel.DrawView += DrawAdapterView; foodLabel = new UILabel(); foodLabel.Text = "Food"; foodLabel.TextColor = UIColor.FromRGBA(nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse("0.9764705882352941")); foodLabel.Font = UIFont.FromName("Helvetica", 18f); foodCarousel = new SfCarousel(); foodCarousel.ItemWidth = 150; foodCarousel.ItemHeight = 150; foodCarousel.AllowLoadMore = true; foodCarousel.LoadMoreItemsCount = 4; UILabel loadmore = new UILabel() { TextColor = UIColor.Black, Text = "Load More...", Font = UIFont.FromName("Helvetica-Bold", 13f), TextAlignment = UITextAlignment.Center }; UIView loadView = new UIView(); loadmore.Frame = new CoreGraphics.CGRect(12, 61, 150, 17); loadView.BackgroundColor = UIColor.FromRGB(255, 255, 255); loadView.AddSubview(loadmore); foodCarousel.LoadMoreView = loadView; foodCarousel.ItemSpacing = 15; foodCarousel.ViewMode = SFCarouselViewMode.SFCarouselViewModeLinear; foodCarousel.ItemsSource = carouselViewModel.TransportCollection; foodCarousel.DrawView += DrawFoodAdapterView; LoadMoreLayout.AddSubview(applicationLabel); LoadMoreLayout.AddSubview(applicationCarousel); LoadMoreLayout.AddSubview(foodLabel); LoadMoreLayout.AddSubview(foodCarousel); bankingLabel = new UILabel(); bankingLabel.Text = "Banking"; bankingLabel.TextColor = UIColor.FromRGBA(nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse("0.9764705882352941")); bankingLabel.Font = UIFont.FromName("Helvetica", 18f); bankCarousel = new SfCarousel(); bankCarousel.ItemWidth = 150; bankCarousel.ItemHeight = 150; bankCarousel.AllowLoadMore = true; bankCarousel.LoadMoreItemsCount = 4; UILabel loadmore1 = new UILabel() { TextColor = UIColor.Black, Text = "Load More...", Font = UIFont.FromName("Helvetica-Bold", 13f), TextAlignment = UITextAlignment.Center }; UIView loadView1 = new UIView(); loadmore1.Frame = new CoreGraphics.CGRect(12, 61, 150, 17); loadView1.BackgroundColor = UIColor.FromRGB(255, 255, 255); loadView1.AddSubview(loadmore1); bankCarousel.LoadMoreView = loadView1; bankCarousel.ItemSpacing = 15; bankCarousel.ViewMode = SFCarouselViewMode.SFCarouselViewModeLinear; bankCarousel.ItemsSource = carouselViewModel.OfficeCollection; bankCarousel.DrawView += DrawBankAdapterView; LoadMoreLayout.AddSubview(applicationLabel); LoadMoreLayout.AddSubview(applicationCarousel); LoadMoreLayout.AddSubview(foodLabel); LoadMoreLayout.AddSubview(foodCarousel); LoadMoreLayout.AddSubview(bankingLabel); LoadMoreLayout.AddSubview(bankCarousel); carouselScrollview.AddSubview(LoadMoreLayout); this.AddSubview(carouselScrollview); }
public Vegetables() { InitializeComponent(); SfCarousel flash = new SfCarousel() { ItemHeight = 490, ItemWidth = 300 }; ObservableCollection <SfCarouselItem> allItems = new ObservableCollection <SfCarouselItem>(); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "bell.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "carrots.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "corn.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "kohl.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "peas.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "tomato.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "potato.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "cuc.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "egg.png", Aspect = Aspect.AspectFit } }); flash.ItemsSource = allItems; this.Content = flash; }
public override View GetSampleContent(Context context1) { context = context1; width = context1.Resources.DisplayMetrics.WidthPixels; height = context1.Resources.DisplayMetrics.HeightPixels; density = context1.Resources.DisplayMetrics.Density; carousel = new SfCarousel(context); carousel1 = new SfCarousel(context); carousel2 = new SfCarousel(context); carouselObj = new CarouselPropertyClass(); modelObj = new CarouselModel(); carousel.AllowLoadMore = true; carousel.LoadMoreItemsCount = 2; carousel1.AllowLoadMore = true; carousel1.LoadMoreItemsCount = 2; carousel2.AllowLoadMore = true; carousel2.LoadMoreItemsCount = 2; TextView text = new TextView(context1) { TextAlignment = TextAlignment.Center, Text = "Load More...", TextSize = 10, Typeface = Typeface.DefaultBold, Gravity = GravityFlags.Center }; text.SetBackgroundColor(Color.White); TextView text1 = new TextView(context1) { TextAlignment = TextAlignment.Center, Text = "Load More...", TextSize = 10, Typeface = Typeface.DefaultBold, Gravity = GravityFlags.Center }; text1.SetBackgroundColor(Color.White); TextView text2 = new TextView(context1) { TextAlignment = TextAlignment.Center, Text = "Load More...", TextSize = 10, Typeface = Typeface.DefaultBold, Gravity = GravityFlags.Center }; text2.SetBackgroundColor(Color.White); carousel.LoadMoreView = text; carousel1.LoadMoreView = text1; carousel2.LoadMoreView = text2; carousel.ItemsSource = modelObj.ApplicationCollection; carousel.ItemSpacing = 80; carousel1.ItemsSource = modelObj.TransportCollection; carousel1.ItemSpacing = 80; carousel2.ItemsSource = modelObj.OfficeCollection; carousel2.ItemSpacing = 80; carousel.ViewMode = ViewMode.Linear; carousel1.ViewMode = ViewMode.Linear; carousel2.ViewMode = ViewMode.Linear; if (context.Resources.DisplayMetrics.Density > 1.5) { carousel.ItemHeight = Convert.ToInt32(110 * context.Resources.DisplayMetrics.Density); carousel.ItemWidth = Convert.ToInt32(110 * context.Resources.DisplayMetrics.Density); carousel1.ItemHeight = Convert.ToInt32(110 * context.Resources.DisplayMetrics.Density); carousel1.ItemWidth = Convert.ToInt32(110 * context.Resources.DisplayMetrics.Density); carousel2.ItemHeight = Convert.ToInt32(110 * context.Resources.DisplayMetrics.Density); carousel2.ItemWidth = Convert.ToInt32(110 * context.Resources.DisplayMetrics.Density); } carousel.LayoutParameters = new LayoutParams(LinearLayout.LayoutParams.MatchParent, (int)(120 * density)); carousel1.LayoutParameters = new LayoutParams(LinearLayout.LayoutParams.MatchParent, (int)(120 * density)); carousel2.LayoutParameters = new LayoutParams(LinearLayout.LayoutParams.MatchParent, (int)(120 * density)); mainLayout = new LinearLayout(context); mainLayout.Orientation = Orientation.Vertical; mainLayout.SetGravity(GravityFlags.CenterHorizontal); mainLayout.SetBackgroundColor(Color.Rgb(249, 249, 249)); mainLayout.LayoutParameters = new LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); carousel.Adapter = new CarouselAdapter(context1, modelObj.ApplicationCollection); carousel1.Adapter = new CarouselAdapter(context1, modelObj.TransportCollection); carousel2.Adapter = new CarouselAdapter(context1, modelObj.OfficeCollection); HeaderMethod(context); mainLayout.AddView(carousel); HeaderMethod1(context); mainLayout.AddView(carousel1); HeaderMethod2(context); mainLayout.AddView(carousel2); return(mainLayout); }
public Clothes() { InitializeComponent(); SfCarousel flash = new SfCarousel() { ItemWidth = 300, ItemHeight = 490 }; ObservableCollection <SfCarouselItem> allItems = new ObservableCollection <SfCarouselItem>(); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "ear.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "high.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "jeans.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "neck.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "scarf.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "shirt.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "shoes.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "skirt.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "sunn.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "swim.png", Aspect = Aspect.AspectFit } }); flash.ItemsSource = allItems; this.Content = flash; }
public Animals() { InitializeComponent(); SfCarousel flash = new SfCarousel() { ItemHeight = 490, ItemWidth = 300 }; ObservableCollection <SfCarouselItem> allItems = new ObservableCollection <SfCarouselItem>(); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "bear.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "beee.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "dog.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "cat.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "cow.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "bird.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "fox.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "fish.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "horse.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "sheep.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "turtle.png", Aspect = Aspect.AspectFit } }); flash.ItemsSource = allItems; this.Content = flash; }
void AddMainView() { if (childGrid == null) { childGrid = new UIView(); } mainGrid = new UIView(); mainGrid.BackgroundColor = UIColor.FromRGB(243, 239, 233); mainGrid.AddSubview(childGrid); maps = new SFMap(); maps.ZoomLevel = 4; maps.MinimumZoom = 4; maps.MaximumZoom = 10; layer = new ImageryLayer(); layer.GeoCoordinates = new CGPoint(27.1751, 78.0421); PopulationMarker marker1 = new PopulationMarker(); marker1.Latitude = 20.6843f; marker1.Longitude = -88.5678f; layer.Markers.Add(marker1); PopulationMarker marker2 = new PopulationMarker(); marker2.Latitude = -13.1631f; marker2.Longitude = -72.5450f; layer.Markers.Add(marker2); PopulationMarker marker3 = new PopulationMarker(); marker3.Latitude = -22.9519f; marker3.Longitude = -43.2106f; layer.Markers.Add(marker3); PopulationMarker marker4 = new PopulationMarker(); marker4.Latitude = 41.8902; marker4.Longitude = 12.4922; layer.Markers.Add(marker4); PopulationMarker marker5 = new PopulationMarker(); marker5.Latitude = 30.3285; marker5.Longitude = 35.4444; layer.Markers.Add(marker5); PopulationMarker marker6 = new PopulationMarker(); marker6.Latitude = 27.1751; marker6.Longitude = 78.0421; layer.Markers.Add(marker6); PopulationMarker marker7 = new PopulationMarker(); marker7.Latitude = 40.4319; marker7.Longitude = 116.5704; layer.Markers.Add(marker7); maps.Layers.Add(layer); maps.Delegate = new OSMDelegate(this); mainGrid.AddSubview(maps); carousel = new SfCarousel(); carousel.RotationAngle = 0; carousel.SelectedIndex = 5; carousel.SelectionChanged += Carousel_SelectionChanged; mainGrid.AddSubview(carousel); label1 = new UILabel(); label1.TextColor = UIColor.Black; label1.LayoutMargins = new UIEdgeInsets(2, 2, 3, 2); label1.Font = UIFont.FromName("Helvetica", 12); var text = new NSString("©"); var stringAtribute = new NSDictionary(UIStringAttributeKey.Font, label1.Font, UIStringAttributeKey.ForegroundColor, UIColor.Black); UIStringAttributes strAtr = new UIStringAttributes(stringAtribute); label1.Text = text; label1Size = text.GetSizeUsingAttributes(strAtr); label1.BackgroundColor = UIColor.White; mainGrid.AddSubview(label1); label2 = new UILabel(); label2.TextColor = UIColor.FromRGB(0, 212, 255); label2.LayoutMargins = new UIEdgeInsets(1, 2, 3, 2); label2.Font = UIFont.FromName("Helvetica", 12); var text1 = new NSString("OpenStreetMap contributors."); var stringAtribute1 = new NSDictionary(UIStringAttributeKey.Font, label2.Font, UIStringAttributeKey.ForegroundColor, UIColor.FromRGB(0, 212, 255)); UIStringAttributes strAtr1 = new UIStringAttributes(stringAtribute); label2.Text = text1; label2Size = text1.GetSizeUsingAttributes(strAtr1); label2.BackgroundColor = UIColor.White; label2.UserInteractionEnabled = true; UITapGestureRecognizer tapGesture = new UITapGestureRecognizer(); tapGesture.ShouldReceiveTouch += TapGesture_ShouldReceiveTouch; label2.AddGestureRecognizer(tapGesture); mainGrid.AddSubview(label2); }
public School() { InitializeComponent(); SfCarousel flash = new SfCarousel() { ItemWidth = 300, ItemHeight = 490 }; ObservableCollection <SfCarouselItem> allItems = new ObservableCollection <SfCarouselItem>(); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "desk.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "eraser.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "lineal.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "pen.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "sbag.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "sharp.png", Aspect = Aspect.AspectFit } }); allItems.Add(new SfCarouselItem() { ItemContent = new Image() { Source = "pencil.png", Aspect = Aspect.AspectFit } }); flash.ItemsSource = allItems; this.Content = flash; }