├── .gitignore ├── CarouselDemo.sln ├── CarouselDemo ├── Carousel.cs ├── CarouselContent.cs ├── CarouselDemo.cs ├── CarouselDemo.csproj ├── DotButtons.cs ├── DotButtonsLayout.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── Droid ├── Assets │ └── AboutAssets.txt ├── CarouselDemo.Droid.csproj ├── MainActivity.cs ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── Resources │ ├── AboutResources.txt │ ├── Resource.designer.cs │ ├── drawable-hdpi │ │ └── icon.png │ ├── drawable-xhdpi │ │ └── icon.png │ ├── drawable-xxhdpi │ │ └── icon.png │ └── drawable │ │ └── icon.png └── packages.config ├── README.md └── iOS ├── AppDelegate.cs ├── CarouselDemo.iOS.csproj ├── Entitlements.plist ├── Info.plist ├── Main.cs ├── Resources ├── Images.xcassets │ └── AppIcons.appiconset │ │ └── Contents.json └── LaunchScreen.xib └── packages.config /.gitignore: -------------------------------------------------------------------------------- 1 | #Autosave files 2 | *~ 3 | 4 | #build 5 | [Oo]bj/ 6 | [Bb]in/ 7 | packages/ 8 | TestResults/ 9 | 10 | # globs 11 | Makefile.in 12 | *.DS_Store 13 | *.sln.cache 14 | *.suo 15 | *.cache 16 | *.pidb 17 | *.userprefs 18 | *.usertasks 19 | config.log 20 | config.make 21 | config.status 22 | aclocal.m4 23 | install-sh 24 | autom4te.cache/ 25 | *.user 26 | *.tar.gz 27 | tarballs/ 28 | test-results/ 29 | Thumbs.db 30 | 31 | #Mac bundle stuff 32 | *.dmg 33 | *.app 34 | 35 | #resharper 36 | *_Resharper.* 37 | *.Resharper 38 | 39 | #dotCover 40 | *.dotCover 41 | -------------------------------------------------------------------------------- /CarouselDemo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarouselDemo", "CarouselDemo\CarouselDemo.csproj", "{59830C8A-D394-410D-A885-F5CE8463CD21}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarouselDemo.iOS", "iOS\CarouselDemo.iOS.csproj", "{61474129-2DE2-4E74-B6A3-8AE63746E104}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarouselDemo.Droid", "Droid\CarouselDemo.Droid.csproj", "{EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | Debug|iPhoneSimulator = Debug|iPhoneSimulator 15 | Release|iPhone = Release|iPhone 16 | Release|iPhoneSimulator = Release|iPhoneSimulator 17 | Debug|iPhone = Debug|iPhone 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Debug|iPhone.ActiveCfg = Debug|Any CPU 23 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Debug|iPhone.Build.0 = Debug|Any CPU 24 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 25 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 26 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Release|iPhone.ActiveCfg = Release|Any CPU 29 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Release|iPhone.Build.0 = Release|Any CPU 30 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 31 | {59830C8A-D394-410D-A885-F5CE8463CD21}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 32 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator 33 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator 34 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Debug|iPhone.ActiveCfg = Debug|iPhone 35 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Debug|iPhone.Build.0 = Debug|iPhone 36 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator 37 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator 38 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Release|Any CPU.ActiveCfg = Release|iPhone 39 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Release|Any CPU.Build.0 = Release|iPhone 40 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Release|iPhone.ActiveCfg = Release|iPhone 41 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Release|iPhone.Build.0 = Release|iPhone 42 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator 43 | {61474129-2DE2-4E74-B6A3-8AE63746E104}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator 44 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Debug|iPhone.ActiveCfg = Debug|Any CPU 47 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Debug|iPhone.Build.0 = Debug|Any CPU 48 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 49 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 50 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Release|Any CPU.ActiveCfg = Release|Any CPU 51 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Release|Any CPU.Build.0 = Release|Any CPU 52 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Release|iPhone.ActiveCfg = Release|Any CPU 53 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Release|iPhone.Build.0 = Release|Any CPU 54 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 55 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 56 | EndGlobalSection 57 | EndGlobal 58 | -------------------------------------------------------------------------------- /CarouselDemo/Carousel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Xamarin.Forms; 8 | using Near.Classes; 9 | 10 | namespace Near.DotCarousel 11 | { 12 | public class Carousel: AbsoluteLayout 13 | { 14 | private DotButtonsLayout dotLayout; 15 | private CarouselView carousel; 16 | 17 | public Carousel(ObservableCollection pages) 18 | { 19 | //Set the Layout to fill and expand to occupy its whole space. 20 | HorizontalOptions = LayoutOptions.FillAndExpand; 21 | VerticalOptions = LayoutOptions.FillAndExpand; 22 | //Create the CarouselView itself. 23 | carousel = new CarouselView(); 24 | //And make it expand to the whole Layout. 25 | carousel.HorizontalOptions = LayoutOptions.FillAndExpand; 26 | carousel.VerticalOptions = LayoutOptions.FillAndExpand; 27 | //Create that new DataTemplate 28 | var template = new DataTemplate (() => { 29 | //We chose an AbsoluteLayout for this because it is the 30 | //most flexble layout in my opinion. 31 | var page1 = new AbsoluteLayout(); 32 | page1.BackgroundColor = Color.FromHex("2C2E31"); 33 | page1.HorizontalOptions = LayoutOptions.FillAndExpand; 34 | page1.VerticalOptions = LayoutOptions.FillAndExpand; 35 | // We make the background color bindable so the ItemSource 36 | //Can set the color. 37 | page1.SetBinding(AbsoluteLayout.BackgroundColorProperty, "BackgroundColor"); 38 | //Lets create the header label 39 | var lab = new Label() 40 | { 41 | FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))+10, 42 | FontAttributes = FontAttributes.Bold 43 | }; 44 | lab.TextColor = Color.White; 45 | lab.HorizontalOptions = LayoutOptions.Center; 46 | lab.VerticalOptions = LayoutOptions.Center; 47 | // Bind it's content to the Header-attribute 48 | lab.SetBinding(Label.TextProperty, "Header"); 49 | // Create the second label 50 | var lab2 = new Label() 51 | { 52 | FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) 53 | }; 54 | lab2.TextColor = Color.White; 55 | lab2.HorizontalOptions = LayoutOptions.Center; 56 | lab2.VerticalOptions = LayoutOptions.Center; 57 | //Bind its conteent to the Content1-attribute 58 | lab2.SetBinding(Label.TextProperty, "Content1"); 59 | var lab3 = new Label() 60 | { 61 | FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) 62 | }; 63 | lab3.TextColor = Color.White; 64 | lab3.HorizontalOptions = LayoutOptions.Center; 65 | lab3.VerticalOptions = LayoutOptions.Center; 66 | //And finally bind the last label. 67 | lab3.SetBinding(Label.TextProperty, "Content2"); 68 | // Add everything to our Layout. 69 | page1.Children.Add(lab); 70 | page1.Children.Add(lab2); 71 | page1.Children.Add(lab3); 72 | // And position the content 73 | AbsoluteLayout.SetLayoutBounds(lab, new Rectangle(0, 0.3, 1, 0.2)); 74 | AbsoluteLayout.SetLayoutFlags(lab, AbsoluteLayoutFlags.All); 75 | AbsoluteLayout.SetLayoutBounds(lab2, new Rectangle(0, 0.4, 1, 0.2)); 76 | AbsoluteLayout.SetLayoutFlags(lab2, AbsoluteLayoutFlags.All); 77 | AbsoluteLayout.SetLayoutBounds(lab3, new Rectangle(0, 0.5, 1, 0.2)); 78 | AbsoluteLayout.SetLayoutFlags(lab3, AbsoluteLayoutFlags.All); 79 | return page1; 80 | }); 81 | //Assign the passeg pages to the ItemsSource 82 | carousel.ItemsSource = pages; 83 | //Assign the freshly created template 84 | carousel.ItemTemplate = template; 85 | //The ItemSelected event is raised when the user swipes trough the 86 | //carousel view. We subscribe to it to update the page indicators in 87 | //Placeholder 3. Make sure to unsubscribe somewhere 88 | carousel.PositionSelected += pageChanged; 89 | //Add the carousel to the abolsute layout and set its boundaries to fill 90 | //the entire layout 91 | Children.Add(carousel); 92 | AbsoluteLayout.SetLayoutBounds(carousel, new Rectangle(0, 0, 1, 1)); 93 | AbsoluteLayout.SetLayoutFlags(carousel, AbsoluteLayoutFlags.All); 94 | //Create the button layout with as many buttons as there are pages 95 | dotLayout = new DotButtonsLayout(pages.Count, Color.White, 10); 96 | //Subscribe to the click events of the dot buttons to switch to the desired 97 | //page 98 | foreach (DotButton dot in dotLayout.dots) 99 | dot.Clicked += dotClicked; 100 | Children.Add(dotLayout); 101 | AbsoluteLayout.SetLayoutBounds(dotLayout, new Rectangle(0, 0.92, 1, .05)); 102 | AbsoluteLayout.SetLayoutFlags(dotLayout, AbsoluteLayoutFlags.All); 103 | } 104 | //The function that is called when the user swipes trough pages 105 | private void pageChanged(object sender, SelectedPositionChangedEventArgs e) 106 | { 107 | //Get the selected page 108 | var position = (int)(e.SelectedPosition); 109 | //Set all buttons opacity to 0.5 but the selected one, which we set to 1 110 | for(int i = 0;i(); 35 | pages.Add(page1); 36 | pages.Add(page2); 37 | pages.Add(page3); 38 | pages.Add(page4); 39 | var carouselView = new Carousel(pages); 40 | //Thats it! Simply add the carouselView to any Layout and you are all set! 41 | // The root page of your application 42 | MainPage = new ContentPage 43 | { 44 | Content = carouselView 45 | }; 46 | } 47 | 48 | protected override void OnStart() 49 | { 50 | // Handle when your app starts 51 | } 52 | 53 | protected override void OnSleep() 54 | { 55 | // Handle when your app sleeps 56 | } 57 | 58 | protected override void OnResume() 59 | { 60 | // Handle when your app resumes 61 | } 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /CarouselDemo/CarouselDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 7 | {59830C8A-D394-410D-A885-F5CE8463CD21} 8 | Library 9 | CarouselDemo 10 | CarouselDemo 11 | v4.5 12 | Profile78 13 | 14 | 15 | true 16 | full 17 | false 18 | bin\Debug 19 | DEBUG; 20 | prompt 21 | 4 22 | false 23 | 24 | 25 | full 26 | true 27 | bin\Release 28 | prompt 29 | 4 30 | false 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | ..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll 45 | 46 | 47 | ..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll 48 | 49 | 50 | ..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll 51 | 52 | 53 | ..\packages\Xamarin.Forms.CarouselView.2.3.0-pre2\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.CarouselView.dll 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /CarouselDemo/DotButtons.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Xamarin.Forms; 7 | 8 | namespace Near.DotCarousel 9 | { 10 | public class DotButton : BoxView 11 | { 12 | public int index; 13 | public DotButtonsLayout layout; 14 | public event ClickHandler Clicked; 15 | public delegate void ClickHandler(DotButton sender); 16 | public DotButton() 17 | { 18 | var clickCheck = new TapGestureRecognizer() 19 | { 20 | Command = new Command(() => 21 | { 22 | if (Clicked != null) 23 | { 24 | Clicked(this); 25 | } 26 | }) 27 | }; 28 | GestureRecognizers.Add(clickCheck); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /CarouselDemo/DotButtonsLayout.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Xamarin.Forms; 7 | 8 | namespace Near.DotCarousel 9 | { 10 | public class DotButtonsLayout : StackLayout 11 | { 12 | //This array will hold the buttons 13 | public DotButton[] dots; 14 | public DotButtonsLayout(int dotCount,Color dotColor,int dotSize) 15 | { 16 | //Create as many buttons as desired. 17 | dots = new DotButton[dotCount]; 18 | //This class inherits from a StackLayout, so we can stack 19 | //the buttons together from left to right. 20 | Orientation = StackOrientation.Horizontal; 21 | VerticalOptions = LayoutOptions.Center; 22 | HorizontalOptions = LayoutOptions.Center; 23 | //Here we create the buttons. 24 | for (int i = 0; i< dotCount; i++) 25 | { 26 | dots[i] = new DotButton 27 | { 28 | HeightRequest = dotSize, 29 | WidthRequest = dotSize, 30 | BackgroundColor = dotColor, 31 | //All buttons except the first one will get an opacity 32 | //of 0.5 to visualize the first one is selected. 33 | Opacity = 0.5 34 | }; 35 | dots[i].index = i; 36 | dots[i].layout = this; 37 | Children.Add(dots[i]); 38 | } 39 | dots[0].Opacity = 1; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /CarouselDemo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle("CarouselDemo")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("")] 12 | [assembly: AssemblyCopyright("tom")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /CarouselDemo/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Droid/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with your package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); 20 | -------------------------------------------------------------------------------- /Droid/CarouselDemo.Droid.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 7 | {EDFD8F3B-9132-4B3F-A6BA-C602076DF7C2} 8 | Library 9 | CarouselDemo.Droid 10 | Assets 11 | Resources 12 | Resource 13 | Resources\Resource.designer.cs 14 | True 15 | True 16 | CarouselDemo.Droid 17 | Properties\AndroidManifest.xml 18 | v4.4 19 | 20 | 21 | true 22 | full 23 | false 24 | bin\Debug 25 | DEBUG; 26 | prompt 27 | 4 28 | None 29 | false 30 | 31 | 32 | full 33 | true 34 | bin\Release 35 | prompt 36 | 4 37 | false 38 | false 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | ..\packages\Xamarin.Android.Support.v4.21.0.3.0\lib\MonoAndroid10\Xamarin.Android.Support.v4.dll 47 | 48 | 49 | ..\packages\Xamarin.Forms.1.3.5.6335\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll 50 | 51 | 52 | ..\packages\Xamarin.Forms.1.3.5.6335\lib\MonoAndroid10\FormsViewGroup.dll 53 | 54 | 55 | ..\packages\Xamarin.Forms.1.3.5.6335\lib\MonoAndroid10\Xamarin.Forms.Core.dll 56 | 57 | 58 | ..\packages\Xamarin.Forms.1.3.5.6335\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll 59 | 60 | 61 | 62 | 63 | {59830C8A-D394-410D-A885-F5CE8463CD21} 64 | CarouselDemo 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /Droid/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Android.App; 4 | using Android.Content; 5 | using Android.Content.PM; 6 | using Android.Runtime; 7 | using Android.Views; 8 | using Android.Widget; 9 | using Android.OS; 10 | 11 | namespace CarouselDemo.Droid 12 | { 13 | [Activity(Label = "CarouselDemo.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 14 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity 15 | { 16 | protected override void OnCreate(Bundle bundle) 17 | { 18 | base.OnCreate(bundle); 19 | 20 | global::Xamarin.Forms.Forms.Init(this, bundle); 21 | 22 | LoadApplication(new App()); 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Droid/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Droid/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using Android.App; 4 | 5 | // Information about this assembly is defined by the following attributes. 6 | // Change them to the values specific to your project. 7 | 8 | [assembly: AssemblyTitle("CarouselDemo.Droid")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("")] 13 | [assembly: AssemblyCopyright("tom")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 18 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 19 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 20 | 21 | [assembly: AssemblyVersion("1.0.0")] 22 | 23 | // The following attributes are used to specify the signing key for the assembly, 24 | // if desired. See the Mono documentation for more information about signing. 25 | 26 | //[assembly: AssemblyDelaySign(false)] 27 | //[assembly: AssemblyKeyFile("")] 28 | 29 | -------------------------------------------------------------------------------- /Droid/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.axml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable/ 12 | icon.png 13 | 14 | layout/ 15 | main.axml 16 | 17 | values/ 18 | strings.xml 19 | 20 | In order to get the build system to recognize Android resources, set the build action to 21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 22 | instead operate on resource IDs. When you compile an Android application that uses resources, 23 | the build system will package the resources for distribution and generate a class called "R" 24 | (this is an Android convention) that contains the tokens for each one of the resources 25 | included. For example, for the above Resources layout, this is what the R class would expose: 26 | 27 | public class R { 28 | public class drawable { 29 | public const int icon = 0x123; 30 | } 31 | 32 | public class layout { 33 | public const int main = 0x456; 34 | } 35 | 36 | public class strings { 37 | public const int first_string = 0xabc; 38 | public const int second_string = 0xbcd; 39 | } 40 | } 41 | 42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main 43 | to reference the layout/main.axml file, or R.strings.first_string to reference the first 44 | string in the dictionary file values/strings.xml. 45 | -------------------------------------------------------------------------------- /Droid/Resources/Resource.designer.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | // ------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Mono Runtime Version: 4.0.30319.17020 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | 12 | [assembly: Android.Runtime.ResourceDesignerAttribute("CarouselDemo.Droid.Resource", IsApplication=true)] 13 | 14 | namespace CarouselDemo.Droid 15 | { 16 | 17 | 18 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] 19 | public partial class Resource 20 | { 21 | 22 | static Resource() 23 | { 24 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 25 | } 26 | 27 | public static void UpdateIdValues() 28 | { 29 | } 30 | 31 | public partial class Attribute 32 | { 33 | 34 | static Attribute() 35 | { 36 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 37 | } 38 | 39 | private Attribute() 40 | { 41 | } 42 | } 43 | 44 | public partial class Drawable 45 | { 46 | 47 | // aapt resource value: 0x7f020000 48 | public const int icon = 2130837504; 49 | 50 | static Drawable() 51 | { 52 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 53 | } 54 | 55 | private Drawable() 56 | { 57 | } 58 | } 59 | } 60 | } 61 | #pragma warning restore 1591 62 | -------------------------------------------------------------------------------- /Droid/Resources/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomh4/Carousel/4fd0d0c257158562cbcd92b5429ba7642cae3096/Droid/Resources/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /Droid/Resources/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomh4/Carousel/4fd0d0c257158562cbcd92b5429ba7642cae3096/Droid/Resources/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /Droid/Resources/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomh4/Carousel/4fd0d0c257158562cbcd92b5429ba7642cae3096/Droid/Resources/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /Droid/Resources/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomh4/Carousel/4fd0d0c257158562cbcd92b5429ba7642cae3096/Droid/Resources/drawable/icon.png -------------------------------------------------------------------------------- /Droid/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Carousel 2 | This is a CarouselView for Xamarin.Forms which implements a page indicators with clickable buttons 3 | The new implementation also works with material design, changes the dots to squares tough as seen in the right picture. 4 | 5 | 6 | 7 | 8 | 9 | Complete instructions on how to implement the view can be found at : http://hot-totem.com/blog/post/carouselview-pageindicators-xamarinforms -------------------------------------------------------------------------------- /iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | using System.Reflection; 8 | 9 | namespace CarouselDemo.iOS 10 | { 11 | [Register("AppDelegate")] 12 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 13 | { 14 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 15 | { 16 | global::Xamarin.Forms.Forms.Init(); 17 | var cv = typeof (Xamarin.Forms.CarouselView); 18 | var assembly = Assembly.Load(cv.FullName); 19 | 20 | LoadApplication(new App()); 21 | 22 | return base.FinishedLaunching(app, options); 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /iOS/CarouselDemo.iOS.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | iPhoneSimulator 6 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 7 | {61474129-2DE2-4E74-B6A3-8AE63746E104} 8 | Exe 9 | CarouselDemo.iOS 10 | Resources 11 | CarouselDemo.iOS 12 | 13 | 14 | true 15 | full 16 | false 17 | bin\iPhoneSimulator\Debug 18 | DEBUG;ENABLE_TEST_CLOUD; 19 | prompt 20 | 4 21 | false 22 | i386 23 | None 24 | true 25 | true 26 | true 27 | true 28 | iPhone Developer 29 | true 30 | 31 | 32 | full 33 | true 34 | bin\iPhone\Release 35 | prompt 36 | 4 37 | false 38 | ARMv7, ARM64 39 | Entitlements.plist 40 | true 41 | true 42 | iPhone Developer 43 | true 44 | 45 | 46 | full 47 | true 48 | bin\iPhoneSimulator\Release 49 | prompt 50 | 4 51 | false 52 | i386 53 | None 54 | true 55 | iPhone Developer 56 | true 57 | 58 | 59 | true 60 | full 61 | false 62 | bin\iPhone\Debug 63 | DEBUG;ENABLE_TEST_CLOUD; 64 | prompt 65 | 4 66 | false 67 | ARMv7, ARM64 68 | Entitlements.plist 69 | true 70 | iPhone Developer 71 | true 72 | true 73 | true 74 | true 75 | true 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | ..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll 84 | 85 | 86 | ..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll 87 | 88 | 89 | ..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll 90 | 91 | 92 | ..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll 93 | 94 | 95 | ..\packages\Xamarin.Forms.CarouselView.2.3.0-pre1\lib\Xamarin.iOS10\Xamarin.Forms.CarouselView.dll 96 | 97 | 98 | ..\packages\Xamarin.Forms.CarouselView.2.3.0-pre1\lib\Xamarin.iOS10\Xamarin.Forms.CarouselView.iOS.dll 99 | 100 | 101 | ..\packages\Xamarin.Forms.CarouselView.2.3.0-pre1\lib\Xamarin.iOS10\Xamarin.Forms.CarouselView.Platform.dll 102 | 103 | 104 | 105 | 106 | {59830C8A-D394-410D-A885-F5CE8463CD21} 107 | CarouselDemo 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iOS/Info.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CFBundleDisplayName 6 | CarouselDemo 7 | CFBundleIdentifier 8 | com.hottotem.carouseldemo 9 | CFBundleShortVersionString 10 | 1.0 11 | CFBundleVersion 12 | 1.0 13 | LSRequiresIPhoneOS 14 | 15 | MinimumOSVersion 16 | 7.0 17 | UIDeviceFamily 18 | 19 | 1 20 | 2 21 | 22 | UILaunchStoryboardName 23 | LaunchScreen 24 | UIRequiredDeviceCapabilities 25 | 26 | armv7 27 | 28 | UISupportedInterfaceOrientations 29 | 30 | UIInterfaceOrientationPortrait 31 | UIInterfaceOrientationLandscapeLeft 32 | UIInterfaceOrientationLandscapeRight 33 | 34 | UISupportedInterfaceOrientations~ipad 35 | 36 | UIInterfaceOrientationPortrait 37 | UIInterfaceOrientationPortraitUpsideDown 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | XSAppIconAssets 42 | Resources/Images.xcassets/AppIcons.appiconset 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace CarouselDemo.iOS 9 | { 10 | public class Application 11 | { 12 | // This is the main entry point of the application. 13 | static void Main(string[] args) 14 | { 15 | // if you want to use a different Application Delegate class from "AppDelegate" 16 | // you can specify it here. 17 | UIApplication.Main(args, null, "AppDelegate"); 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /iOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "size": "29x29", 5 | "scale": "1x", 6 | "idiom": "iphone" 7 | }, 8 | { 9 | "size": "29x29", 10 | "scale": "2x", 11 | "idiom": "iphone" 12 | }, 13 | { 14 | "size": "29x29", 15 | "scale": "3x", 16 | "idiom": "iphone" 17 | }, 18 | { 19 | "size": "40x40", 20 | "scale": "2x", 21 | "idiom": "iphone" 22 | }, 23 | { 24 | "size": "40x40", 25 | "scale": "3x", 26 | "idiom": "iphone" 27 | }, 28 | { 29 | "size": "57x57", 30 | "scale": "1x", 31 | "idiom": "iphone" 32 | }, 33 | { 34 | "size": "57x57", 35 | "scale": "2x", 36 | "idiom": "iphone" 37 | }, 38 | { 39 | "size": "60x60", 40 | "scale": "2x", 41 | "idiom": "iphone" 42 | }, 43 | { 44 | "size": "60x60", 45 | "scale": "3x", 46 | "idiom": "iphone" 47 | }, 48 | { 49 | "size": "29x29", 50 | "scale": "1x", 51 | "idiom": "ipad" 52 | }, 53 | { 54 | "size": "29x29", 55 | "scale": "2x", 56 | "idiom": "ipad" 57 | }, 58 | { 59 | "size": "40x40", 60 | "scale": "1x", 61 | "idiom": "ipad" 62 | }, 63 | { 64 | "size": "40x40", 65 | "scale": "2x", 66 | "idiom": "ipad" 67 | }, 68 | { 69 | "size": "50x50", 70 | "scale": "1x", 71 | "idiom": "ipad" 72 | }, 73 | { 74 | "size": "50x50", 75 | "scale": "2x", 76 | "idiom": "ipad" 77 | }, 78 | { 79 | "size": "72x72", 80 | "scale": "1x", 81 | "idiom": "ipad" 82 | }, 83 | { 84 | "size": "72x72", 85 | "scale": "2x", 86 | "idiom": "ipad" 87 | }, 88 | { 89 | "size": "76x76", 90 | "scale": "1x", 91 | "idiom": "ipad" 92 | }, 93 | { 94 | "size": "76x76", 95 | "scale": "2x", 96 | "idiom": "ipad" 97 | }, 98 | { 99 | "size": "120x120", 100 | "scale": "1x", 101 | "idiom": "car" 102 | } 103 | ], 104 | "info": { 105 | "version": 1, 106 | "author": "xcode" 107 | } 108 | } -------------------------------------------------------------------------------- /iOS/Resources/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /iOS/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | --------------------------------------------------------------------------------