├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md └── src ├── asset ├── SegmentedRadioButtonControl-1.png └── SegmentedRadioButtonControl.png ├── build ├── 1iveowl-logo.png ├── Plugin.SegmentedControl.Netstandard.nuspec ├── build.ps1 ├── publish.ps1 └── publishLocal.ps1 ├── crossplatform ├── SegCtrl.Droid │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── AboutResources.txt │ │ ├── color │ │ │ └── segmented_control_text.xml │ │ ├── drawable │ │ │ ├── segmented_control_background.xml │ │ │ ├── segmented_control_first_background.xml │ │ │ └── segmented_control_last_background.xml │ │ ├── layout │ │ │ ├── RadioButton.axml │ │ │ └── RadioGroup.axml │ │ └── values │ │ │ └── colors.xml │ ├── SegCtrl.Droid.csproj │ └── SegmentedControlRenderer.cs ├── SegCtrl.UWP │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── Plugin.Segmented.Control.UWP.rd.xml │ ├── SegCtrl.UWP.csproj │ ├── SegmentRadioButton.cs │ ├── SegmentedControlRenderer.cs │ ├── SegmentedRadioButtonStyle.xaml │ ├── SegmentedUserControl.xaml │ └── SegmentedUserControl.xaml.cs ├── SegCtrl.iOS │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SegCtrl.iOS.csproj │ └── SegmentedControlRenderer.cs └── SegCtrl.macOS │ ├── Properties │ └── AssemblyInfo.cs │ ├── SegCtrl.macOS.csproj │ └── SegmentedControlRenderer.cs ├── main ├── SegCtlr.Netstandard.sln └── SegCtlr.Netstandard │ ├── Control │ ├── SegmentedControl.cs │ └── SegmentedControlOption.cs │ ├── Event │ ├── ElementChildrenChanging.cs │ └── SegmentSelectEvent.cs │ ├── PreserveAttribute.cs │ └── SegCtlr.Netstandard.csproj └── test ├── Test.SegCtrl.Android ├── Assets │ └── AboutAssets.txt ├── 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 │ ├── font │ │ └── comicsaaaans.xml │ ├── layout │ │ ├── Tabbar.axml │ │ └── Toolbar.axml │ └── values │ │ └── styles.xml ├── Test.SegCtrl.Android.csproj └── Test.SegCtrl.Android.csproj.bak ├── Test.SegCtrl.UWP ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── LockScreenLogo.scale-100.png │ ├── LockScreenLogo.scale-125.png │ ├── LockScreenLogo.scale-150.png │ ├── LockScreenLogo.scale-200.png │ ├── LockScreenLogo.scale-400.png │ ├── SplashScreen.scale-100.png │ ├── SplashScreen.scale-125.png │ ├── SplashScreen.scale-150.png │ ├── SplashScreen.scale-200.png │ ├── SplashScreen.scale-400.png │ ├── Square150x150Logo.scale-100.png │ ├── Square150x150Logo.scale-125.png │ ├── Square150x150Logo.scale-150.png │ ├── Square150x150Logo.scale-200.png │ ├── Square150x150Logo.scale-400.png │ ├── Square44x44Logo.scale-100.png │ ├── Square44x44Logo.scale-125.png │ ├── Square44x44Logo.scale-150.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.scale-400.png │ ├── Square44x44Logo.targetsize-16_altform-unplated.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── Square44x44Logo.targetsize-256_altform-unplated.png │ ├── Square44x44Logo.targetsize-32_altform-unplated.png │ ├── Square44x44Logo.targetsize-48_altform-unplated.png │ ├── StoreLogo.png │ ├── Wide310x150Logo.scale-100.png │ ├── Wide310x150Logo.scale-125.png │ ├── Wide310x150Logo.scale-150.png │ ├── Wide310x150Logo.scale-200.png │ └── Wide310x150Logo.scale-400.png ├── MainPage.xaml ├── MainPage.xaml.cs ├── Package.appxmanifest ├── Properties │ ├── AssemblyInfo.cs │ └── Default.rd.xml └── Test.SegCtlr.UWP.csproj ├── Test.SegCtrl.iOS ├── AppDelegate.cs ├── Entitlements.plist ├── Info.plist ├── Main.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── Default-568h@2x.png │ ├── Default-Portrait.png │ ├── Default-Portrait@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── Icon-60@2x.png │ ├── Icon-60@3x.png │ ├── Icon-76.png │ ├── Icon-76@2x.png │ ├── Icon-Small-40.png │ ├── Icon-Small-40@2x.png │ ├── Icon-Small-40@3x.png │ ├── Icon-Small.png │ ├── Icon-Small@2x.png │ ├── Icon-Small@3x.png │ └── LaunchScreen.storyboard ├── Test.SegCtlr.iOS.csproj ├── iTunesArtwork └── iTunesArtwork@2x ├── Test.SegCtrl.macOS ├── AppDelegate.cs ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── AppIcon-128.png │ │ ├── AppIcon-128@2x.png │ │ ├── AppIcon-16.png │ │ ├── AppIcon-16@2x.png │ │ ├── AppIcon-256.png │ │ ├── AppIcon-256@2x.png │ │ ├── AppIcon-32.png │ │ ├── AppIcon-32@2x.png │ │ ├── AppIcon-512.png │ │ ├── AppIcon-512@2x.png │ │ └── Contents.json │ └── Contents.json ├── Entitlements.plist ├── Info.plist ├── Main.cs └── Test.SegCtrl.macOS.csproj └── Test.SegCtrl.netstandard ├── App.xaml ├── App.xaml.cs ├── MainPage.xaml ├── MainPage.xaml.cs ├── MainViewModel.cs ├── SecondPage.xaml ├── SecondPage.xaml.cs ├── Test.SegCtrl.netstandard.csproj ├── ThirdPage.xaml └── ThirdPage.xaml.cs /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: https://www.buymeacoffee.com/fEXda8L 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | *.Designer.cs 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | bld/ 24 | [Bb]in/ 25 | [Oo]bj/ 26 | [Ll]og/ 27 | 28 | # Visual Studio 2015 cache/options directory 29 | .vs/ 30 | # Uncomment if you have tasks that create the project's static files in wwwroot 31 | #wwwroot/ 32 | 33 | # MSTest test Results 34 | [Tt]est[Rr]esult*/ 35 | [Bb]uild[Ll]og.* 36 | 37 | # NUNIT 38 | *.VisualState.xml 39 | TestResult.xml 40 | 41 | # Build Results of an ATL Project 42 | [Dd]ebugPS/ 43 | [Rr]eleasePS/ 44 | dlldata.c 45 | 46 | # .NET Core 47 | project.lock.json 48 | project.fragment.lock.json 49 | artifacts/ 50 | **/Properties/launchSettings.json 51 | 52 | *_i.c 53 | *_p.c 54 | *_i.h 55 | *.ilk 56 | *.meta 57 | *.obj 58 | *.pch 59 | *.pdb 60 | *.pgc 61 | *.pgd 62 | *.rsp 63 | *.sbr 64 | *.tlb 65 | *.tli 66 | *.tlh 67 | *.tmp 68 | *.tmp_proj 69 | *.log 70 | *.vspscc 71 | *.vssscc 72 | .builds 73 | *.pidb 74 | *.svclog 75 | *.scc 76 | 77 | # Chutzpah Test files 78 | _Chutzpah* 79 | 80 | # Visual C++ cache files 81 | ipch/ 82 | *.aps 83 | *.ncb 84 | *.opendb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | *.VC.db 89 | *.VC.VC.opendb 90 | 91 | # Visual Studio profiler 92 | *.psess 93 | *.vsp 94 | *.vspx 95 | *.sap 96 | 97 | # TFS 2012 Local Workspace 98 | $tf/ 99 | 100 | # Guidance Automation Toolkit 101 | *.gpState 102 | 103 | # ReSharper is a .NET coding add-in 104 | _ReSharper*/ 105 | *.[Rr]e[Ss]harper 106 | *.DotSettings.user 107 | 108 | # JustCode is a .NET coding add-in 109 | .JustCode 110 | 111 | # TeamCity is a build add-in 112 | _TeamCity* 113 | 114 | # DotCover is a Code Coverage Tool 115 | *.dotCover 116 | 117 | # Visual Studio code coverage results 118 | *.coverage 119 | *.coveragexml 120 | 121 | # NCrunch 122 | _NCrunch_* 123 | .*crunch*.local.xml 124 | nCrunchTemp_* 125 | 126 | # MightyMoose 127 | *.mm.* 128 | AutoTest.Net/ 129 | 130 | # Web workbench (sass) 131 | .sass-cache/ 132 | 133 | # Installshield output folder 134 | [Ee]xpress/ 135 | 136 | # DocProject is a documentation generator add-in 137 | DocProject/buildhelp/ 138 | DocProject/Help/*.HxT 139 | DocProject/Help/*.HxC 140 | DocProject/Help/*.hhc 141 | DocProject/Help/*.hhk 142 | DocProject/Help/*.hhp 143 | DocProject/Help/Html2 144 | DocProject/Help/html 145 | 146 | # Click-Once directory 147 | publish/ 148 | 149 | # Publish Web Output 150 | *.[Pp]ublish.xml 151 | *.azurePubxml 152 | # TODO: Comment the next line if you want to checkin your web deploy settings 153 | # but database connection strings (with potential passwords) will be unencrypted 154 | *.pubxml 155 | *.publishproj 156 | 157 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 158 | # checkin your Azure Web App publish settings, but sensitive information contained 159 | # in these scripts will be unencrypted 160 | PublishScripts/ 161 | 162 | # NuGet Packages 163 | *.nupkg 164 | # The packages folder can be ignored because of Package Restore 165 | **/packages/* 166 | # except build/, which is used as an MSBuild target. 167 | !**/packages/build/ 168 | # Uncomment if necessary however generally it will be regenerated when needed 169 | #!**/packages/repositories.config 170 | # NuGet v3's project.json files produces more ignorable files 171 | *.nuget.props 172 | *.nuget.targets 173 | 174 | # Microsoft Azure Build Output 175 | csx/ 176 | *.build.csdef 177 | 178 | # Microsoft Azure Emulator 179 | ecf/ 180 | rcf/ 181 | 182 | # Windows Store app package directories and files 183 | AppPackages/ 184 | BundleArtifacts/ 185 | Package.StoreAssociation.xml 186 | _pkginfo.txt 187 | 188 | # Visual Studio cache files 189 | # files ending in .cache can be ignored 190 | *.[Cc]ache 191 | # but keep track of directories ending in .cache 192 | !*.[Cc]ache/ 193 | 194 | # Others 195 | ClientBin/ 196 | ~$* 197 | *~ 198 | *.dbmdl 199 | *.dbproj.schemaview 200 | *.jfm 201 | *.pfx 202 | *.publishsettings 203 | orleans.codegen.cs 204 | 205 | # Since there are multiple workflows, uncomment next line to ignore bower_components 206 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 207 | #bower_components/ 208 | 209 | # RIA/Silverlight projects 210 | Generated_Code/ 211 | 212 | # Backup & report files from converting an old project file 213 | # to a newer Visual Studio version. Backup files are not needed, 214 | # because we have git ;-) 215 | _UpgradeReport_Files/ 216 | Backup*/ 217 | UpgradeLog*.XML 218 | UpgradeLog*.htm 219 | 220 | # SQL Server files 221 | *.mdf 222 | *.ldf 223 | *.ndf 224 | 225 | # Business Intelligence projects 226 | *.rdl.data 227 | *.bim.layout 228 | *.bim_*.settings 229 | 230 | # Microsoft Fakes 231 | FakesAssemblies/ 232 | 233 | # GhostDoc plugin setting file 234 | *.GhostDoc.xml 235 | 236 | # Node.js Tools for Visual Studio 237 | .ntvs_analysis.dat 238 | node_modules/ 239 | 240 | # Typescript v1 declaration files 241 | typings/ 242 | 243 | # Visual Studio 6 build log 244 | *.plg 245 | 246 | # Visual Studio 6 workspace options file 247 | *.opt 248 | 249 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 250 | *.vbw 251 | 252 | # Visual Studio LightSwitch build output 253 | **/*.HTMLClient/GeneratedArtifacts 254 | **/*.DesktopClient/GeneratedArtifacts 255 | **/*.DesktopClient/ModelManifest.xml 256 | **/*.Server/GeneratedArtifacts 257 | **/*.Server/ModelManifest.xml 258 | _Pvt_Extensions 259 | 260 | # Paket dependency manager 261 | .paket/paket.exe 262 | paket-files/ 263 | 264 | # FAKE - F# Make 265 | .fake/ 266 | 267 | # JetBrains Rider 268 | .idea/ 269 | *.sln.iml 270 | 271 | # CodeRush 272 | .cr/ 273 | 274 | # Python Tools for Visual Studio (PTVS) 275 | __pycache__/ 276 | *.pyc 277 | 278 | # Cake - Uncomment if you are using it 279 | # tools/** 280 | # !tools/packages.config 281 | 282 | # Telerik's JustMock configuration file 283 | *.jmconfig 284 | 285 | # BizTalk build output 286 | *.btp.cs 287 | *.btm.cs 288 | *.odx.cs 289 | *.xsd.cs 290 | 291 | # MFractor 292 | .mfractor/ 293 | 294 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 1iveowl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Plugin Segmented Control for Xamarin Forms and .NET Standard 2 | 3 | [![NuGet Badge](https://buildstats.info/nuget/Plugin.SegmentedControl.Netstandard)](https://www.nuget.org/packages/Plugin.SegmentedControl.Netstandard/) 4 | 5 | *Please star this project if you find it useful. Thank you!* 6 | 7 | ## Update - Version 5.2+ 8 | Version 5.2 and forward migrated to AndroidX for Android. 9 | 10 | ## Update - Version 5.4.5+ (PR: #101) 11 | ItemsSource is now of type IEnumerable instead of IList. 12 | It can contains full objects. 13 | When it contains a list of full object, the text displayed in a segment is read from a property on each object: define this property using TextPropertyName. 14 | 15 | `TextPropertyName`: string, name of a property in an `ItemsSource[i]` object. 16 | If `TextPropertyName` is set, the displayed text is read from this property on each source object. 17 | If `TextPropertyName` is not set, ItemsSource must be a list of string. 18 | 19 | New property: `SelectedItem` 20 | `SelectedItem = Items[SelectedSegment]` 21 | `SelectedItem` contains the current selected object from `ItemsSource`. 22 | 23 | ### Fix: 24 | Remove the extra padding below the control on Android, caused by the wrong usage of match_parent. 25 | 26 | ## Why this library? 27 | There are other Segmented Control libraries out there. This library adds two important capabilities: 28 | - It works across all four key platforms: iOS, Android, macOS, and UWP - all other libraries I've encounted lack UWP and/or macOS. 29 | - It's based on .NET Standard 2.0 30 | 31 | Furthermore, this library is has more flexibility and features than other libraries that I'm aware of. 32 | 33 | Enjoy! And please don't forget to star this project if you find it useful and/or provide feedback if you run into issues or shortcomings. 34 | 35 | ## Supported platforms 36 | |Platform|Supported|Version|Renderer| 37 | | ------------------- | :-----------: | :-----------: | :------------------: | 38 | |Xamarin.iOS Unified|Yes|iOS 8.1+|UISegmentedControl| 39 | |Xamarin.Android|Yes|API 21+|RadioGroup| 40 | |Xamarin.UWP|Yes|Win10 16299+|User Control/RadioButton| 41 | |Xamarin.MacOS|Partial|10.0+|NSSegmentedControl| 42 | 43 | ## Features 44 | 45 | - Bindable Tint color 46 | - Bindable Select color 47 | - Bindable Text color 48 | - Bindable Disabled color 49 | - Bindable Font size 50 | - Bindable Font Family 51 | - Bindable Item Text 52 | - Bindable Selected Item 53 | - Bindable ICommand 54 | - Bindable IsEnabled Item 55 | - Bindable ItemsSource 56 | - Bindable Border color (Android & iOS only) 57 | - Bindable Border width (Android & iOS only) 58 | 59 | For more details please see below or for even more details see: [Test/Demo App](https://github.com/1iveowl/Plugin.SegmentedControl/tree/master/src/test/Test.SegCtrl.netstandard) 60 | 61 | ## How to use 62 | Using this plugin is easy. 63 | 64 | ### iOS 65 | Add initializer to `AppDelegate` 66 | 67 | ```csharp 68 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 69 | { 70 | global::Xamarin.Forms.Forms.Init(); 71 | 72 | Plugin.Segmented.Control.iOS.SegmentedControlRenderer.Initialize(); 73 | ... 74 | } 75 | ``` 76 | 77 | ### UWP 78 | 79 | You need to add the assembly to App.xaml.cs in you project. For more details see the Xamarin documentation [here](https://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/universal/#Troubleshooting). 80 | 81 | ```csharp 82 | var assembliesToInclude = new List {typeof(Plugin.Segmented.Control.UWP.SegmentedControlRenderer).GetTypeInfo().Assembly}; 83 | 84 | Xamarin.Forms.Forms.Init(e, assembliesToInclude); 85 | ``` 86 | 87 | ### Android 88 | No special needs. 89 | 90 | For using custom fonts with Android see this blog post: [https://blog.verslu.is/xamarin/xamarin-forms-xamarin/custom-fonts-with-xamarin-forms-revisited/](https://blog.verslu.is/xamarin/xamarin-forms-xamarin/custom-fonts-with-xamarin-forms-revisited/) 91 | 92 | #### .NET Standard 93 | The Xamarin Forms must use .NET Standard. I suggest using .NET Standard 2.0+. 94 | 95 | Here is a great blog post about how to move your PCL to .NET Standard: [Building Xamarin.Forms Apps with .NET Standard](https://blog.xamarin.com/building-xamarin-forms-apps-net-standard/) 96 | 97 | #### XAML 98 | ![Plugin Segmented Control Picture](https://github.com/1iveowl/Plugin.SegmentedControl/blob/master/src/asset/SegmentedRadioButtonControl-1.png "Plugin Segmented Control") 99 | 100 | 101 | ```xml 102 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 144 | 145 | 146 | 147 | ``` 148 | You can bind to the SegmentSelectedCommand for notification in your view model when a segment change has occurred. 149 | ```xml 150 | 153 | ``` 154 | 155 | ## Credits 156 | For inspiration and for the Android and iOS part I'd like to thank Alex Rainman for his great work on [SegmentedControl.FormsPlugin](https://www.nuget.org/packages/SegmentedControl.FormsPlugin/). 157 | 158 | Thank you to [rjantz3](https://github.com/rjantz3) for adding much requested features and enhancements. 159 | Thank you to [Thomas Kälin](https://github.com/thomaskaelin) for critical Android and iOS fixes and improvements. 160 | -------------------------------------------------------------------------------- /src/asset/SegmentedRadioButtonControl-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/asset/SegmentedRadioButtonControl-1.png -------------------------------------------------------------------------------- /src/asset/SegmentedRadioButtonControl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/asset/SegmentedRadioButtonControl.png -------------------------------------------------------------------------------- /src/build/1iveowl-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/build/1iveowl-logo.png -------------------------------------------------------------------------------- /src/build/Plugin.SegmentedControl.Netstandard.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Plugin.SegmentedControl.Netstandard 5 | 0 6 | Segmented Control for Xamarin Forms (.Net Standard) 7 | 1iveowl Development 8 | Jasper H. Bojsen 9 | MIT 10 | images\1iveowl-logo.png 11 | https://github.com/1iveowl/Plugin.SegmentedControl 12 | false 13 | 14 | Segmented control for Xamarin Forms for iOS, Android, UWP. Mac OS also supported albeit currently with fewer features. 15 | 16 | [All] Min Width bug fixes 17 | [All] New TextPropertyName object for ItemSource 18 | [All] ItemSource is not IEnumerable (was IList) 19 | [Android, UWP] SegmentedControlOption.IsEnabled fixed. 20 | [UWP, Android] Lower the required SDK: UWP supports UWP 16299+; Android supports 21+ 21 | [UWP] Fixed TextColor not initially set bug. 22 | [Android] Moved to AndroidX 23 | [Android] Fixes 24 | [iOS and Android only] Added BorderColor and BorderWidth 25 | [All] Moved back to .NET Standard 2.0 26 | [UWP] Re-enabled UWP 27 | [All] TextColor added - i.e. Unselected text color. 28 | [Android] Custom font fixed. 29 | [iOS] iOS 13+ tint color issue fixed. 30 | [All] Allow selected segment to be changed from view model binding. 31 | [All] User interaction with Commands. 32 | [All] Implement the IsEnabled property on individual segments. 33 | [All] ICommand. 34 | [All] Font size. 35 | [All] Font Family. 36 | [All] Fixes and improvements. 37 | [iOS] IsEnabled binding bug fixed. 38 | 39 | Copyright 2022 40 | xamarin xamarin.forms segmentedControl netstandard iOS UWP Android macOS 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 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 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /src/build/build.ps1: -------------------------------------------------------------------------------- 1 | param([string]$version) 2 | 3 | if ([string]::IsNullOrEmpty($version)) {$version = "0.0.1"} 4 | 5 | if ($IsMacOS) { 6 | $msbuild = "msbuild" 7 | } else { 8 | $vswhere = 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' 9 | $msbuild = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath 10 | $msbuild = join-path $msbuild 'MSBuild\Current\Bin\MSBuild.exe' 11 | } 12 | 13 | &$msbuild ..\main\SegCtlr.Netstandard\SegCtlr.Netstandard.csproj /t:Build /p:Configuration="Release" 14 | &$msbuild ..\crossplatform\SegCtrl.Droid\SegCtrl.Droid.csproj /t:Build /p:Configuration="Release" 15 | &$msbuild ..\crossplatform\SegCtrl.UWP\SegCtrl.UWP.csproj /t:Build /p:Configuration="Release" 16 | &$msbuild ..\crossplatform\SegCtrl.iOS\SegCtrl.iOS.csproj /t:Build /p:Configuration="Release" 17 | &$msbuild ..\crossplatform\SegCtrl.macOS\SegCtrl.macOS.csproj /t:Build /p:Configuration="Release" 18 | 19 | Remove-Item .\NuGet -Force -Recurse 20 | New-Item -ItemType Directory -Force -Path .\NuGet 21 | NuGet.exe pack Plugin.SegmentedControl.Netstandard.nuspec -Verbosity detailed -Symbols -OutputDir "NuGet" -Version $version 22 | #NuGet.exe pack Plugin.SegmentedControl.Netstandard.nuspec -Verbosity detailed -Symbols -SymbolPackageFormat snupkg -OutputDir "NuGet" -Version $version -------------------------------------------------------------------------------- /src/build/publish.ps1: -------------------------------------------------------------------------------- 1 | param([string]$betaver) 2 | 3 | if ([string]::IsNullOrEmpty($betaver)) { 4 | $version = [Reflection.AssemblyName]::GetAssemblyName((resolve-path '..\main\SegCtlr.Netstandard\bin\Release\netstandard2.0\Plugin.Segmented.dll')).Version.ToString(3) 5 | } 6 | else { 7 | $version = [Reflection.AssemblyName]::GetAssemblyName((resolve-path '..\main\SegCtlr.Netstandard\bin\Release\netstandard2.0\Plugin.Segmented.dll')).Version.ToString(3) + "-" + $betaver 8 | } 9 | 10 | .\build.ps1 $version 11 | 12 | Nuget.exe push ".\NuGet\Plugin.SegmentedControl.Netstandard.$version.symbols.nupkg" -Source https://api.nuget.org/v3/index.json -------------------------------------------------------------------------------- /src/build/publishLocal.ps1: -------------------------------------------------------------------------------- 1 | param([string]$betaver) 2 | 3 | if ([string]::IsNullOrEmpty($betaver)) { 4 | $version = [Reflection.AssemblyName]::GetAssemblyName((resolve-path '..\main\SegCtlr.Netstandard\bin\Release\netstandard2.0\Plugin.Segmented.dll')).Version.ToString(3) 5 | } 6 | else { 7 | $version = [Reflection.AssemblyName]::GetAssemblyName((resolve-path '..\main\SegCtlr.Netstandard\bin\Release\netstandard2.0\Plugin.Segmented.dll')).Version.ToString(3) + "-" + $betaver 8 | } 9 | 10 | .\build.ps1 $version 11 | 12 | nuget.exe push -Source "1iveowlNuGetRepo" -ApiKey key ".\NuGet\Plugin.SegmentedControl.Netstandard.$version.symbols.snupkg" 13 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.Droid/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Android.App; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Plugin.Segmented.Control.Droid")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Plugin.Segmented.Control.Droid")] 14 | [assembly: AssemblyCopyright("Copyright © 2017")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.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. -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.Droid/Resources/color/segmented_control_text.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.Droid/Resources/drawable/segmented_control_background.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.Droid/Resources/drawable/segmented_control_first_background.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.Droid/Resources/drawable/segmented_control_last_background.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.Droid/Resources/layout/RadioButton.axml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.Droid/Resources/layout/RadioGroup.axml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.Droid/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | @android:color/transparent 4 | #007AFF 5 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.UWP/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Plugin.Segmented.Control.UWP")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Plugin.Segmented.Control.UWP")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.UWP/Properties/Plugin.Segmented.Control.UWP.rd.xml: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.UWP/SegCtrl.UWP.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2848D7D8-3C18-4DF0-8638-CBCCC36A325B} 8 | Library 9 | Properties 10 | Plugin.Segmented.Control.UWP 11 | Plugin.Segmented.Control.UWP 12 | en-US 13 | UAP 14 | 10.0.19041.0 15 | 10.0.16299.0 16 | 14 17 | 512 18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 19 | 20 | 21 | AnyCPU 22 | true 23 | portable 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 27 | prompt 28 | 4 29 | 30 | 31 | true 32 | AnyCPU 33 | pdbonly 34 | true 35 | bin\Release\ 36 | TRACE;NETFX_CORE;WINDOWS_UWP 37 | prompt 38 | 4 39 | 40 | 41 | x86 42 | true 43 | bin\x86\Debug\ 44 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 45 | ;2008 46 | full 47 | x86 48 | false 49 | prompt 50 | 51 | 52 | x86 53 | bin\x86\Release\ 54 | TRACE;NETFX_CORE;WINDOWS_UWP 55 | true 56 | ;2008 57 | pdbonly 58 | x86 59 | false 60 | prompt 61 | 62 | 63 | ARM 64 | true 65 | bin\ARM\Debug\ 66 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 67 | ;2008 68 | full 69 | ARM 70 | false 71 | prompt 72 | 73 | 74 | ARM 75 | bin\ARM\Release\ 76 | TRACE;NETFX_CORE;WINDOWS_UWP 77 | true 78 | ;2008 79 | pdbonly 80 | ARM 81 | false 82 | prompt 83 | 84 | 85 | x64 86 | true 87 | bin\x64\Debug\ 88 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 89 | ;2008 90 | full 91 | x64 92 | false 93 | prompt 94 | 95 | 96 | x64 97 | bin\x64\Release\ 98 | TRACE;NETFX_CORE;WINDOWS_UWP 99 | true 100 | ;2008 101 | pdbonly 102 | x64 103 | false 104 | prompt 105 | 106 | 107 | PackageReference 108 | 109 | 110 | 111 | SegmentedUserControl.xaml 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 6.2.13 121 | 122 | 123 | 5.0.0.2291 124 | 125 | 126 | 127 | 128 | {aba23bab-084a-443e-b9cc-37b0a826377e} 129 | SegCtlr.Netstandard 130 | 131 | 132 | 133 | 134 | Designer 135 | MSBuild:Compile 136 | 137 | 138 | Designer 139 | MSBuild:Compile 140 | PreserveNewest 141 | 142 | 143 | 144 | 145 | 14.0 146 | 147 | 148 | bin\DebugNAtive\ 149 | TRACE;NETFX_CORE;WINDOWS_UWP 150 | true 151 | true 152 | pdbonly 153 | AnyCPU 154 | false 155 | prompt 156 | MinimumRecommendedRules.ruleset 157 | 158 | 159 | bin\x86\DebugNAtive\ 160 | TRACE;NETFX_CORE;WINDOWS_UWP 161 | true 162 | ;2008 163 | true 164 | pdbonly 165 | x86 166 | false 167 | prompt 168 | MinimumRecommendedRules.ruleset 169 | 170 | 171 | bin\ARM\DebugNAtive\ 172 | TRACE;NETFX_CORE;WINDOWS_UWP 173 | true 174 | ;2008 175 | true 176 | pdbonly 177 | ARM 178 | false 179 | prompt 180 | MinimumRecommendedRules.ruleset 181 | 182 | 183 | bin\x64\DebugNAtive\ 184 | TRACE;NETFX_CORE;WINDOWS_UWP 185 | true 186 | ;2008 187 | true 188 | pdbonly 189 | x64 190 | false 191 | prompt 192 | MinimumRecommendedRules.ruleset 193 | 194 | 195 | 202 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.UWP/SegmentRadioButton.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml; 2 | using Windows.UI.Xaml.Controls; 3 | using Windows.UI.Xaml.Media; 4 | 5 | namespace Plugin.Segmented.Control.UWP 6 | { 7 | public class SegmentRadioButton : RadioButton 8 | { 9 | public static readonly DependencyProperty SelectedTextColorProperty = DependencyProperty.Register( 10 | "SelectedTextColor", 11 | typeof(SolidColorBrush), typeof(SegmentRadioButton), 12 | new PropertyMetadata(default(SolidColorBrush), new PropertyChangedCallback(OnSelectedTextChanged))); 13 | 14 | public SolidColorBrush SelectedTextColor 15 | { 16 | get => (SolidColorBrush) GetValue(SelectedTextColorProperty); 17 | set => SetValue(SelectedTextColorProperty, value); 18 | } 19 | 20 | public static readonly DependencyProperty TextColorProperty = DependencyProperty.Register( 21 | "TextColor", 22 | typeof(SolidColorBrush), 23 | typeof(SegmentRadioButton), 24 | new PropertyMetadata(default(SolidColorBrush), new PropertyChangedCallback(OnTextColorChanged))); 25 | 26 | 27 | public SolidColorBrush TextColor 28 | { 29 | get => (SolidColorBrush)GetValue(TextColorProperty); 30 | set => SetValue(TextColorProperty, value); 31 | } 32 | 33 | public static readonly DependencyProperty TintColorProperty = DependencyProperty.Register( 34 | "TintColor", 35 | typeof(SolidColorBrush), 36 | typeof(SegmentRadioButton), new PropertyMetadata(default(SolidColorBrush), new PropertyChangedCallback(OnTintChanged))); 37 | 38 | public SolidColorBrush TintColor 39 | { 40 | get => (SolidColorBrush) GetValue(TintColorProperty); 41 | set => SetValue(TintColorProperty, value); 42 | } 43 | 44 | public static readonly DependencyProperty DisabledColorProperty = DependencyProperty.Register( 45 | "DisabledColor", typeof(SolidColorBrush), typeof(SegmentRadioButton), new PropertyMetadata(default(SolidColorBrush), new PropertyChangedCallback(OnDisabledColorChanged))); 46 | 47 | public SolidColorBrush DisabledColor 48 | { 49 | get => (SolidColorBrush) GetValue(DisabledColorProperty); 50 | set => SetValue(DisabledColorProperty, value); 51 | } 52 | 53 | 54 | public SegmentRadioButton() 55 | { 56 | this.IsEnabledChanged += SegmentRadioButton_IsEnabledChanged; 57 | } 58 | 59 | private void SegmentRadioButton_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) 60 | { 61 | if (sender is SegmentRadioButton segment) 62 | { 63 | Refresh(segment); 64 | } 65 | } 66 | 67 | private static void OnTintChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 68 | { 69 | if (d is SegmentRadioButton segment) 70 | { 71 | segment.BorderBrush = (SolidColorBrush) e.NewValue; 72 | Refresh(segment); 73 | } 74 | } 75 | 76 | 77 | private static void OnDisabledColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 78 | { 79 | if (d is SegmentRadioButton segment) 80 | { 81 | segment.BorderBrush = (SolidColorBrush)e.NewValue; 82 | Refresh(segment); 83 | } 84 | } 85 | 86 | private static void OnSelectedTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 87 | { 88 | if (d is SegmentRadioButton segment) 89 | { 90 | segment.SelectedTextColor = (SolidColorBrush)e.NewValue; 91 | Refresh(segment); 92 | } 93 | } 94 | 95 | private static void OnTextColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 96 | { 97 | 98 | if (d is SegmentRadioButton segment) 99 | { 100 | segment.TextColor = (SolidColorBrush)e.NewValue; 101 | Refresh(segment); 102 | } 103 | } 104 | 105 | private static void Refresh(SegmentRadioButton segment) 106 | { 107 | // Go to "Indeterminate" State to ensure that the GotoState is refreshed even if the state is the same. 108 | // Necessary because properties might have changed even when the state have not. 109 | 110 | VisualStateManager.GoToState(segment, "Indeterminate", false); 111 | 112 | if (segment.IsChecked ?? false) 113 | { 114 | VisualStateManager.GoToState(segment, segment.IsEnabled ? "Checked" : "DisabledAndChecked", false); 115 | } 116 | else 117 | { 118 | VisualStateManager.GoToState(segment, segment.IsEnabled ? "Unchecked" : "DisabledAndUnchecked", false); 119 | } 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.UWP/SegmentedControlRenderer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | using Windows.UI.Xaml; 5 | using Windows.UI.Xaml.Controls; 6 | using Windows.UI.Xaml.Media; 7 | using Plugin.Segmented.Control; 8 | using Plugin.Segmented.Control.UWP; 9 | using Xamarin.Forms.Platform.UWP; 10 | 11 | [assembly: ExportRenderer(typeof(SegmentedControl), typeof(SegmentedControlRenderer))] 12 | namespace Plugin.Segmented.Control.UWP 13 | { 14 | [Preserve(AllMembers = true)] 15 | public class SegmentedControlRenderer : ViewRenderer 16 | { 17 | private SegmentedUserControl _segmentedUserControl; 18 | 19 | private readonly ColorConverter _colorConverter = new ColorConverter(); 20 | 21 | public SegmentedControlRenderer() {} 22 | 23 | protected override void OnElementChanged(ElementChangedEventArgs e) 24 | { 25 | base.OnElementChanged(e); 26 | 27 | if (e.OldElement != null) 28 | { 29 | DisposeEventHandlers(); 30 | } 31 | 32 | if (_segmentedUserControl is null || e.NewElement != null) 33 | { 34 | CreateSegmentedRadioButtonControl(); 35 | } 36 | } 37 | 38 | protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) 39 | { 40 | base.OnElementPropertyChanged(sender, e); 41 | 42 | if (e.PropertyName == "Renderer") 43 | { 44 | Element?.RaiseSelectionChanged(); 45 | return; 46 | } 47 | 48 | if (_segmentedUserControl is null || Element is null) return; 49 | 50 | switch (e.PropertyName) 51 | { 52 | case nameof(SegmentedControl.SelectedSegment): 53 | SetSelectedSegment(); 54 | break; 55 | 56 | case nameof(SegmentedControl.TintColor): 57 | SetTintColor(); 58 | break; 59 | 60 | case nameof(SegmentedControl.IsEnabled): 61 | SetIsEnabled(); 62 | break; 63 | 64 | case nameof(SegmentedControl.DisabledColor): 65 | SetDisabledColor(); 66 | break; 67 | 68 | case nameof(SegmentedControl.TextColor): 69 | SetTextColor(); 70 | break; 71 | 72 | case nameof(SegmentedControl.SelectedTextColor): 73 | SetSelectedTextColor(); 74 | break; 75 | 76 | case nameof(SegmentedControl.Children): 77 | SetChildren(); 78 | break; 79 | 80 | case nameof(SegmentedControl.FontSize): 81 | SetFontSize(); 82 | break; 83 | 84 | case nameof(SegmentedControl.FontFamily): 85 | SetFontFamily(); 86 | break; 87 | } 88 | } 89 | 90 | private void SetFontSize() 91 | { 92 | if (Element.FontSize > 0) 93 | { 94 | foreach (SegmentRadioButton segment in _segmentedUserControl.SegmentedControlGrid.Children) 95 | { 96 | segment.FontSize = Element.FontSize; 97 | }; 98 | } 99 | } 100 | 101 | private void SetFontFamily() 102 | { 103 | if (!string.IsNullOrWhiteSpace(Element.FontFamily)) 104 | { 105 | foreach (SegmentRadioButton segment in _segmentedUserControl.SegmentedControlGrid.Children) 106 | { 107 | segment.FontFamily = new FontFamily(Element.FontFamily); 108 | }; 109 | } 110 | } 111 | 112 | private void SetSelectedSegment() 113 | { 114 | if (_segmentedUserControl.SegmentedControlGrid.Children 115 | .Where(x => 116 | { 117 | var btn = (RadioButton)x; 118 | 119 | int.TryParse(btn.Tag.ToString(), out var i); 120 | return i == Element.SelectedSegment; 121 | }) 122 | .FirstOrDefault() is RadioButton checkedButton) 123 | { 124 | checkedButton.IsChecked = true; 125 | } 126 | 127 | } 128 | 129 | private void SetTintColor() 130 | { 131 | _segmentedUserControl.SegmentedControlGrid.BorderBrush = (SolidColorBrush)_colorConverter.Convert(Element.TintColor, null, null, ""); 132 | 133 | foreach (var segment in _segmentedUserControl.SegmentedControlGrid.Children) 134 | { 135 | ((SegmentRadioButton)segment).TintColor = (SolidColorBrush)_colorConverter.Convert(Element.TintColor, null, null, ""); 136 | } 137 | } 138 | 139 | private void SetIsEnabled() 140 | { 141 | if (Element.IsEnabled) 142 | { 143 | foreach (var uiElement in _segmentedUserControl.SegmentedControlGrid.Children) 144 | { 145 | var segment = (SegmentRadioButton)uiElement; 146 | segment.IsEnabled = true; 147 | } 148 | _segmentedUserControl.SegmentedControlGrid.BorderBrush = (SolidColorBrush)_colorConverter.Convert(Element.TintColor, null, null, ""); 149 | } 150 | else 151 | { 152 | foreach (var uiElement in _segmentedUserControl.SegmentedControlGrid.Children) 153 | { 154 | var segment = (SegmentRadioButton)uiElement; 155 | segment.IsEnabled = false; 156 | } 157 | _segmentedUserControl.SegmentedControlGrid.BorderBrush = (SolidColorBrush)_colorConverter.Convert(Element.DisabledColor, null, null, ""); 158 | } 159 | } 160 | 161 | private void SetDisabledColor() 162 | { 163 | foreach (var segment in _segmentedUserControl.SegmentedControlGrid.Children) 164 | { 165 | ((SegmentRadioButton)segment).DisabledColor = (SolidColorBrush)_colorConverter.Convert(Element.DisabledColor, null, null, ""); 166 | } 167 | 168 | if (!Element.IsEnabled) 169 | { 170 | _segmentedUserControl.SegmentedControlGrid.BorderBrush = (SolidColorBrush)_colorConverter.Convert(Element.DisabledColor, null, null, ""); 171 | } 172 | } 173 | 174 | private void SetTextColor() 175 | { 176 | foreach (var segment in _segmentedUserControl.SegmentedControlGrid.Children) 177 | { 178 | ((SegmentRadioButton)segment).TextColor = (SolidColorBrush)_colorConverter.Convert( 179 | Element.TextColor, null, null, ""); 180 | } 181 | } 182 | 183 | private void SetSelectedTextColor() 184 | { 185 | foreach (var segment in _segmentedUserControl.SegmentedControlGrid.Children) 186 | { 187 | ((SegmentRadioButton)segment).SelectedTextColor = (SolidColorBrush)_colorConverter.Convert(Element.SelectedTextColor, null, null, ""); 188 | } 189 | } 190 | 191 | private void SetChildren() 192 | { 193 | if (Element.Children != null) 194 | { 195 | DisposeEventHandlers(); 196 | CreateSegmentedRadioButtonControl(); 197 | } 198 | } 199 | 200 | private void CreateSegmentedRadioButtonControl() 201 | { 202 | _segmentedUserControl = new SegmentedUserControl(); 203 | 204 | var radioButtonGroupName = Guid.NewGuid().ToString(); 205 | 206 | var grid = _segmentedUserControl.SegmentedControlGrid; 207 | grid.BorderBrush = (SolidColorBrush) _colorConverter.Convert(Element.TintColor, null, null, ""); 208 | 209 | grid.ColumnDefinitions.Clear(); 210 | grid.Children.Clear(); 211 | 212 | foreach (var (child, i) in Element.Children.Select((child, i) => (child, i))) 213 | { 214 | var segmentButton = new SegmentRadioButton 215 | { 216 | GroupName = radioButtonGroupName, 217 | Style = (Style)_segmentedUserControl.Resources["SegmentedRadioButtonStyle"], 218 | Content = child.Text, 219 | Tag = i, 220 | HorizontalAlignment = HorizontalAlignment.Stretch, 221 | VerticalAlignment = VerticalAlignment.Stretch, 222 | BorderBrush = (SolidColorBrush)_colorConverter.Convert(Element.TintColor, null, null, ""), 223 | TextColor = (SolidColorBrush)_colorConverter.Convert(Element.TextColor, null, null, ""), 224 | SelectedTextColor = (SolidColorBrush)_colorConverter.Convert(Element.SelectedTextColor, null, null, ""), 225 | TintColor = (SolidColorBrush)_colorConverter.Convert(Element.TintColor, null, null, ""), 226 | DisabledColor = (SolidColorBrush)_colorConverter.Convert(Element.DisabledColor, null, null, ""), 227 | BorderThickness = i > 0 ? new Thickness(1, 0, 0, 0) : new Thickness(0, 0, 0, 0), 228 | IsEnabled = Element.Children[i].IsEnabled, 229 | MinWidth = 0, 230 | }; 231 | 232 | segmentButton.Checked += SegmentRadioButtonOnChecked; 233 | 234 | if (i == Element.SelectedSegment) 235 | { 236 | segmentButton.IsChecked = true; 237 | } 238 | 239 | if (Element.FontSize > 0) 240 | { 241 | segmentButton.FontSize = Element.FontSize; 242 | } 243 | 244 | if (!string.IsNullOrEmpty(Element.FontFamily)) 245 | { 246 | segmentButton.FontFamily = new FontFamily(Element.FontFamily); 247 | } 248 | 249 | var columnDefinition = new ColumnDefinition 250 | { 251 | Width = new GridLength(1, GridUnitType.Star), 252 | }; 253 | 254 | if (Element.WidthRequest > 0) 255 | columnDefinition.Width = new GridLength(Element.WidthRequest); 256 | 257 | grid.ColumnDefinitions.Add(columnDefinition); 258 | 259 | segmentButton.SetValue(Grid.ColumnProperty, i); 260 | 261 | grid.Children.Add(segmentButton); 262 | 263 | child.PropertyChanged += Segment_PropertyChanged; 264 | } 265 | 266 | SetNativeControl(_segmentedUserControl); 267 | } 268 | 269 | private void Segment_PropertyChanged(object sender, PropertyChangedEventArgs e) 270 | { 271 | if (!(_segmentedUserControl is null) && !(Element is null) && sender is SegmentedControlOption option) 272 | { 273 | var index = Element.Children.IndexOf(option); 274 | switch (e.PropertyName) 275 | { 276 | case nameof(SegmentedControlOption.Text): 277 | _segmentedUserControl.SegmentedControlGrid.Children[index].SetValue(ContentControl.ContentProperty, option.Text); 278 | break; 279 | case nameof(SegmentedControlOption.IsEnabled): 280 | _segmentedUserControl.SegmentedControlGrid.Children[index].SetValue(Windows.UI.Xaml.Controls.Control.IsEnabledProperty, option.IsEnabled); 281 | break; 282 | } 283 | } 284 | } 285 | 286 | private void SegmentRadioButtonOnChecked(object sender, RoutedEventArgs e) 287 | { 288 | var button = (SegmentRadioButton) sender; 289 | 290 | if (!(button is null)) 291 | { 292 | Element.SelectedSegment = int.Parse(button.Tag.ToString()); 293 | Element?.RaiseSelectionChanged(); 294 | } 295 | } 296 | 297 | protected override void Dispose(bool disposing) 298 | { 299 | DisposeEventHandlers(); 300 | base.Dispose(disposing); 301 | } 302 | 303 | private void DisposeEventHandlers() 304 | { 305 | 306 | if (_segmentedUserControl?.SegmentedControlGrid?.Children != null) 307 | { 308 | foreach (var element in _segmentedUserControl.SegmentedControlGrid.Children) 309 | { 310 | if (element is SegmentRadioButton segment) 311 | { 312 | segment.Checked -= SegmentRadioButtonOnChecked; 313 | } 314 | } 315 | } 316 | 317 | if (!(Element is null)) 318 | { 319 | foreach (var child in Element.Children) 320 | { 321 | child.PropertyChanged -= Segment_PropertyChanged; 322 | } 323 | } 324 | } 325 | 326 | } 327 | } 328 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.UWP/SegmentedRadioButtonStyle.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.UWP/SegmentedUserControl.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.UWP/SegmentedUserControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using Windows.UI.Xaml.Controls; 2 | 3 | // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 4 | 5 | namespace Plugin.Segmented.Control.UWP 6 | { 7 | public sealed partial class SegmentedUserControl : UserControl 8 | { 9 | public Grid SegmentedControlGrid => mainGrid; 10 | public SegmentedUserControl() 11 | { 12 | this.InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.iOS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Plugin.Segmented.Control.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Plugin.Segmented.Control.iOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("39cd5d35-d98e-49a2-868b-89e7b64d25de")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.iOS/SegCtrl.iOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {39CD5D35-D98E-49A2-868B-89E7B64D25DE} 9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | Library 11 | Plugin.Segmented.Control.iOS 12 | Resources 13 | Plugin.Segmented.Control.iOS 14 | 15 | 16 | 17 | 18 | true 19 | portable 20 | false 21 | bin\Debug 22 | DEBUG; 23 | prompt 24 | 4 25 | false 26 | 27 | 28 | full 29 | true 30 | bin\Release 31 | prompt 32 | 4 33 | false 34 | true 35 | true 36 | true 37 | snupkg 38 | 39 | 40 | bin\DebugNAtive\ 41 | __UNIFIED__;__MOBILE__;__IOS__; 42 | true 43 | full 44 | AnyCPU 45 | false 46 | prompt 47 | MinimumRecommendedRules.ruleset 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | {aba23bab-084a-443e-b9cc-37b0a826377e} 65 | SegCtlr.Netstandard 66 | 67 | 68 | 69 | 70 | 5.0.0.2291 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.iOS/SegmentedControlRenderer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using Plugin.Segmented.Control; 6 | using Plugin.Segmented.Control.iOS; 7 | using UIKit; 8 | using Xamarin.Forms; 9 | using Xamarin.Forms.Platform.iOS; 10 | 11 | [assembly: ExportRenderer(typeof(SegmentedControl), typeof(SegmentedControlRenderer))] 12 | namespace Plugin.Segmented.Control.iOS 13 | { 14 | [Preserve(AllMembers = true)] 15 | public class SegmentedControlRenderer : ViewRenderer 16 | { 17 | private UISegmentedControl _nativeControl; 18 | 19 | protected override void OnElementChanged(ElementChangedEventArgs e) 20 | { 21 | base.OnElementChanged(e); 22 | 23 | if (Control is null && Element != null) 24 | { 25 | _nativeControl = new UISegmentedControl 26 | { 27 | Enabled = Element.IsEnabled 28 | }; 29 | 30 | SetNativeControlSegments(Element.Children); 31 | SetNativeControl(_nativeControl); 32 | SetEnabledStateColor(); 33 | SetFont(); 34 | SetSelectedTextColor(); 35 | SetTextColor(); 36 | SetBorder(); 37 | } 38 | 39 | if (!(e.OldElement is null)) 40 | { 41 | if (!(_nativeControl is null)) 42 | { 43 | _nativeControl.ValueChanged -= NativeControl_SelectionChanged; 44 | } 45 | 46 | RemoveElementHandlers(); 47 | } 48 | 49 | if (!(e.NewElement is null)) 50 | { 51 | if (!(_nativeControl is null)) 52 | { 53 | _nativeControl.ValueChanged += NativeControl_SelectionChanged; 54 | } 55 | 56 | AddElementHandlers(e.NewElement); 57 | } 58 | } 59 | 60 | private void SetNativeControlSegments(IList children) 61 | { 62 | if (!(_nativeControl is null)) 63 | { 64 | if (_nativeControl.NumberOfSegments > 0) 65 | { 66 | _nativeControl.RemoveAllSegments(); 67 | } 68 | 69 | foreach (var (child, i) in children.Select((child, i) => ( child, i))) 70 | { 71 | _nativeControl.InsertSegment(child.Text, i, false); 72 | _nativeControl.SetEnabled(children[i].IsEnabled, i); 73 | 74 | if (children[i].WidthRequest > 0) 75 | _nativeControl.SetWidth((nfloat)children[i].WidthRequest, i); 76 | } 77 | 78 | if (!(Element is null)) 79 | { 80 | _nativeControl.SelectedSegment = Element.SelectedSegment; 81 | } 82 | } 83 | } 84 | 85 | private void AddElementHandlers(SegmentedControl element, bool addChildHandlersOnly = false) 86 | { 87 | if (!(element is null)) 88 | { 89 | if (!addChildHandlersOnly) 90 | { 91 | element.OnElementChildrenChanging += OnElementChildrenChanging; 92 | } 93 | 94 | if (!(element.Children is null)) 95 | { 96 | foreach (var child in element.Children) 97 | { 98 | child.PropertyChanged += SegmentPropertyChanged; 99 | } 100 | } 101 | } 102 | } 103 | 104 | private void RemoveElementHandlers(bool removeChildrenHandlersOnly = false) 105 | { 106 | if (!(Element is null)) 107 | { 108 | if (!removeChildrenHandlersOnly) 109 | { 110 | Element.OnElementChildrenChanging -= OnElementChildrenChanging; 111 | } 112 | 113 | if (!(Element.Children is null)) 114 | { 115 | foreach (var child in Element.Children) 116 | { 117 | child.PropertyChanged -= SegmentPropertyChanged; 118 | } 119 | } 120 | } 121 | } 122 | 123 | private void OnElementChildrenChanging(object sender, EventArgs e) 124 | { 125 | RemoveElementHandlers(true); 126 | } 127 | 128 | 129 | private void SegmentPropertyChanged(object sender, PropertyChangedEventArgs e) 130 | { 131 | if (!(_nativeControl is null) && !(Element is null) && sender is SegmentedControlOption option) 132 | { 133 | var index = Element.Children.IndexOf(option); 134 | 135 | switch (e.PropertyName) 136 | { 137 | case nameof(SegmentedControlOption.Text): 138 | _nativeControl.SetTitle(option.Text, index); 139 | break; 140 | case nameof(SegmentedControlOption.IsEnabled): 141 | _nativeControl.SetEnabled(option.IsEnabled, index); 142 | break; 143 | } 144 | } 145 | } 146 | 147 | protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) 148 | { 149 | base.OnElementPropertyChanged(sender, e); 150 | 151 | if (e.PropertyName == "Renderer") 152 | { 153 | Element?.RaiseSelectionChanged(); 154 | return; 155 | } 156 | 157 | if (_nativeControl is null || Element is null) 158 | { 159 | return; 160 | } 161 | 162 | switch (e.PropertyName) 163 | { 164 | case nameof(SegmentedControl.SelectedSegment): 165 | _nativeControl.SelectedSegment = Element.SelectedSegment; 166 | Element.RaiseSelectionChanged(); 167 | break; 168 | 169 | case nameof(SegmentedControl.TintColor): 170 | SetEnabledStateColor(); 171 | break; 172 | 173 | case nameof(SegmentedControl.IsEnabled): 174 | _nativeControl.Enabled = Element.IsEnabled; 175 | SetEnabledStateColor(); 176 | break; 177 | 178 | case nameof(SegmentedControl.SelectedTextColor): 179 | SetSelectedTextColor(); 180 | break; 181 | 182 | case nameof(SegmentedControl.TextColor): 183 | SetTextColor(); 184 | break; 185 | 186 | case nameof(SegmentedControl.Children): 187 | if (!(Element.Children is null)) 188 | { 189 | SetNativeControlSegments(Element.Children); 190 | AddElementHandlers(Element, true); 191 | } 192 | break; 193 | 194 | case nameof(SegmentedControl.FontSize): 195 | case nameof(SegmentedControl.FontFamily): 196 | SetFont(); 197 | break; 198 | 199 | case nameof(SegmentedControl.BorderWidth): 200 | case nameof(SegmentedControl.BorderColor): 201 | SetBorder(); 202 | break; 203 | } 204 | } 205 | 206 | private void SetEnabledStateColor() 207 | { 208 | if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0)) 209 | { 210 | _nativeControl.SelectedSegmentTintColor = Element.IsEnabled 211 | ? Element.TintColor.ToUIColor() 212 | : Element.DisabledColor.ToUIColor(); 213 | } 214 | else 215 | { 216 | _nativeControl.TintColor = Element.IsEnabled 217 | ? Element.TintColor.ToUIColor() 218 | : Element.DisabledColor.ToUIColor(); 219 | } 220 | } 221 | 222 | private void SetFont() 223 | { 224 | var uiTextAttribute = _nativeControl.GetTitleTextAttributes(UIControlState.Normal); 225 | 226 | var font = string.IsNullOrEmpty(Element.FontFamily) 227 | ? UIFont.SystemFontOfSize((nfloat)Element.FontSize) 228 | : UIFont.FromName(Element.FontFamily, (nfloat)Element.FontSize); 229 | 230 | uiTextAttribute.Font = font; 231 | 232 | _nativeControl.SetTitleTextAttributes(uiTextAttribute, UIControlState.Normal); 233 | } 234 | 235 | private void SetTextColor() 236 | { 237 | var uiTextAttribute = _nativeControl.GetTitleTextAttributes(UIControlState.Normal); 238 | 239 | uiTextAttribute.TextColor = Element.TextColor.ToUIColor(); 240 | 241 | _nativeControl.SetTitleTextAttributes(uiTextAttribute, UIControlState.Normal); 242 | } 243 | 244 | private void SetSelectedTextColor() 245 | { 246 | var uiTextAttribute = _nativeControl.GetTitleTextAttributes(UIControlState.Normal); 247 | 248 | uiTextAttribute.TextColor = Element.SelectedTextColor.ToUIColor(); 249 | 250 | _nativeControl.SetTitleTextAttributes(uiTextAttribute, UIControlState.Selected); 251 | } 252 | 253 | private void SetBorder() 254 | { 255 | _nativeControl.Layer.BorderWidth = (nfloat)Element.BorderWidth; 256 | 257 | _nativeControl.Layer.BorderColor = Element.IsEnabled ? 258 | Element.BorderColor.ToCGColor() : 259 | Element.DisabledColor.ToCGColor(); 260 | } 261 | 262 | private void NativeControl_SelectionChanged(object sender, EventArgs e) 263 | { 264 | Element.SelectedSegment = (int)_nativeControl.SelectedSegment; 265 | } 266 | 267 | protected override void Dispose(bool disposing) 268 | { 269 | if (!(_nativeControl is null)) 270 | { 271 | _nativeControl.ValueChanged -= NativeControl_SelectionChanged; 272 | _nativeControl?.Dispose(); 273 | _nativeControl = null; 274 | } 275 | RemoveElementHandlers(); 276 | 277 | base.Dispose(disposing); 278 | } 279 | 280 | public static void Initialize() 281 | { 282 | 283 | } 284 | } 285 | } -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.macOS/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("SegCtrl.macOS")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Orion Law Management Systems, Inc.")] 11 | [assembly: AssemblyProduct("")] 12 | [assembly: AssemblyCopyright("Copyright 2018")] 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 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.macOS/SegCtrl.macOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {BF907E43-0F07-4502-9AF3-96B063281234} 8 | {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 9 | Library 10 | SegCtrl.macOS 11 | SegCtrl.macOS 12 | v2.0 13 | Xamarin.Mac 14 | Resources 15 | 16 | 17 | 18 | 19 | true 20 | portable 21 | false 22 | bin\Debug 23 | DEBUG; 24 | prompt 25 | 4 26 | false 27 | false 28 | false 29 | false 30 | false 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | false 40 | true 41 | bin\Release 42 | 43 | 44 | prompt 45 | 4 46 | false 47 | false 48 | false 49 | false 50 | false 51 | 52 | 53 | 54 | 55 | 56 | 57 | portable 58 | true 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | {ABA23BAB-084A-443E-B9CC-37B0A826377E} 73 | SegCtlr.Netstandard 74 | 75 | 76 | 77 | 78 | 2.0.3 79 | 80 | 81 | 5.0.0.2291 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /src/crossplatform/SegCtrl.macOS/SegmentedControlRenderer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using Xamarin.Forms; 4 | using AppKit; 5 | using Xamarin.Forms.Platform.MacOS; 6 | using Plugin.Segmented.Control; 7 | using System.ComponentModel; 8 | using Plugin.Segmented; 9 | 10 | [assembly: ExportRenderer(typeof(SegmentedControl), typeof(SegCtrl.macOS.SegmentedControlRenderer))] 11 | namespace SegCtrl.macOS 12 | { 13 | [Preserve(AllMembers = true)] 14 | public class SegmentedControlRenderer : ViewRenderer 15 | { 16 | private NSSegmentedControl _nativeControl; 17 | 18 | protected override void OnElementChanged(ElementChangedEventArgs e) 19 | { 20 | base.OnElementChanged(e); 21 | 22 | if (Control is null && Element != null) 23 | { 24 | CreateNativeSegmentedControl(); 25 | } 26 | 27 | if (!(e.OldElement is null)) 28 | { 29 | RemoveElementHandlers(); 30 | } 31 | 32 | AddElementHandlers(e.NewElement); 33 | } 34 | 35 | private void CreateNativeSegmentedControl() 36 | { 37 | var titles = Element.Children.Select(s => s.Text); 38 | _nativeControl = NSSegmentedControl.FromLabels(titles.ToArray(), NSSegmentSwitchTracking.SelectOne, OnNativeSegmentChanged); 39 | _nativeControl.Enabled = Element.IsEnabled; 40 | _nativeControl.SetSelected(true, Element.SelectedSegment); 41 | _nativeControl.FocusRingType = NSFocusRingType.None; 42 | 43 | foreach (var (segmentedCtrlOption, i) in Element.Children.Select((segmentCtrlOption, i) => (segmentCtrlOption, i))) 44 | { 45 | if(segmentedCtrlOption.WidthRequest >= 0) 46 | _nativeControl.SetWidth((nfloat)segmentedCtrlOption.WidthRequest, i); 47 | } 48 | 49 | SetFont(); 50 | SetNativeControl(_nativeControl); 51 | } 52 | 53 | private void OnNativeSegmentChanged() 54 | { 55 | if (!(_nativeControl is null)) 56 | { 57 | Element.SelectedSegment = (int)_nativeControl.SelectedSegment; 58 | } 59 | } 60 | 61 | private void ResetNativeControl() 62 | { 63 | if (!(_nativeControl is null) && !(Element is null)) 64 | { 65 | if (_nativeControl.SegmentCount > 0) 66 | { 67 | _nativeControl.RemoveFromSuperview(); 68 | _nativeControl.Dispose(); 69 | _nativeControl = null; 70 | CreateNativeSegmentedControl(); 71 | } 72 | } 73 | } 74 | 75 | private void AddElementHandlers(SegmentedControl element, bool addChildHandlersOnly = false) 76 | { 77 | if (!(element is null)) 78 | { 79 | if (!addChildHandlersOnly) 80 | { 81 | element.OnElementChildrenChanging += OnElementChildrenChanging; 82 | } 83 | if (!(element.Children is null)) 84 | { 85 | foreach (var child in element.Children) 86 | { 87 | child.PropertyChanged += SegmentPropertyChanged; 88 | } 89 | } 90 | } 91 | } 92 | 93 | private void RemoveElementHandlers(bool removeChildrenHandlersOnly = false) 94 | { 95 | if (!(Element is null)) 96 | { 97 | if (!removeChildrenHandlersOnly) 98 | { 99 | Element.OnElementChildrenChanging -= OnElementChildrenChanging; 100 | } 101 | 102 | if (!(Element.Children is null)) 103 | { 104 | foreach (var child in Element.Children) 105 | { 106 | child.PropertyChanged -= SegmentPropertyChanged; 107 | } 108 | } 109 | } 110 | } 111 | 112 | private void OnElementChildrenChanging(object sender, EventArgs e) 113 | { 114 | RemoveElementHandlers(true); 115 | } 116 | 117 | private void SegmentPropertyChanged(object sender, PropertyChangedEventArgs e) 118 | { 119 | if (!(_nativeControl is null) && !(Element is null) && sender is SegmentedControlOption option) 120 | { 121 | var index = Element.Children.IndexOf(option); 122 | 123 | switch (e.PropertyName) 124 | { 125 | case nameof(SegmentedControlOption.Text): 126 | _nativeControl.SetLabel(option.Text, index); 127 | break; 128 | 129 | case nameof(SegmentedControlOption.IsEnabled): 130 | _nativeControl.SetEnabled(option.IsEnabled, index); 131 | break; 132 | } 133 | } 134 | } 135 | 136 | protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) 137 | { 138 | base.OnElementPropertyChanged(sender, e); 139 | 140 | if (e.PropertyName == "Renderer") 141 | { 142 | Element?.RaiseSelectionChanged(); 143 | return; 144 | } 145 | 146 | if (_nativeControl is null || Element is null) 147 | { 148 | return; 149 | } 150 | 151 | switch (e.PropertyName) 152 | { 153 | case nameof(NSSegmentedControl.SelectedSegment): 154 | _nativeControl.SelectedSegment = Element.SelectedSegment; 155 | Element.RaiseSelectionChanged(); 156 | break; 157 | 158 | case nameof(NSSegmentedControl.IsEnabled): 159 | _nativeControl.Enabled = Element.IsEnabled; 160 | break; 161 | 162 | case nameof(SegmentedControl.Children): 163 | ResetNativeControl(); 164 | break; 165 | 166 | case nameof(SegmentedControl.FontSize): 167 | case nameof(SegmentedControl.FontFamily): 168 | SetFont(); 169 | break; 170 | } 171 | } 172 | 173 | private void SetFont() 174 | { 175 | var font = NSFont.FromFontName(string.IsNullOrEmpty(Element.FontFamily) 176 | ? _nativeControl.Font.FontName 177 | : Element.FontFamily, (nfloat)Element.FontSize); 178 | _nativeControl.Font = font; 179 | } 180 | 181 | protected override void Dispose(bool disposing) 182 | { 183 | RemoveElementHandlers(); 184 | 185 | base.Dispose(disposing); 186 | _nativeControl = null; 187 | } 188 | 189 | public static void Initialize() 190 | { 191 | 192 | } 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /src/main/SegCtlr.Netstandard/Control/SegmentedControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using System.Windows.Input; 7 | using Plugin.Segmented.Event; 8 | using Xamarin.Forms; 9 | using Xamarin.Forms.Internals; 10 | 11 | namespace Plugin.Segmented.Control 12 | { 13 | [DesignTimeVisible(true)] 14 | [Preserve(AllMembers = true)] 15 | [ContentProperty(nameof(Children))] 16 | public class SegmentedControl : View, IViewContainer 17 | { 18 | public SegmentedControl() 19 | { 20 | Children = new List(); 21 | } 22 | 23 | public event EventHandler OnElementChildrenChanging; 24 | 25 | public event EventHandler OnSegmentSelected; 26 | 27 | #region Children 28 | public static readonly BindableProperty ChildrenProperty = BindableProperty.Create(nameof(Children), typeof(IList), typeof(SegmentedControl), default(IList), propertyChanging: OnChildrenChanging); 29 | private static void OnChildrenChanging(BindableObject bindable, object oldValue, object newValue) 30 | { 31 | if (bindable is SegmentedControl segmentedControl 32 | && newValue is IList newItemsList 33 | && segmentedControl.Children != null) 34 | { 35 | segmentedControl.OnElementChildrenChanging?.Invoke(segmentedControl, new ElementChildrenChanging((IList)oldValue, newItemsList)); 36 | segmentedControl.Children.Clear(); 37 | 38 | foreach (var newSegment in newItemsList) 39 | { 40 | newSegment.BindingContext = segmentedControl.BindingContext; 41 | segmentedControl.Children.Add(newSegment); 42 | } 43 | } 44 | } 45 | public IList Children 46 | { 47 | get => (IList)GetValue(ChildrenProperty); 48 | set => SetValue(ChildrenProperty, value); 49 | } 50 | #endregion 51 | 52 | #region ItemsSource 53 | public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create(nameof(ItemsSource), typeof(IEnumerable), typeof(SegmentedControl)); 54 | public static readonly BindableProperty TextPropertyNameProperty = BindableProperty.Create(nameof(TextPropertyName), typeof(string), typeof(SegmentedControl)); 55 | 56 | private void OnItemsSourceChanged() 57 | { 58 | var itemsSource = ItemsSource; 59 | var items = itemsSource as IList; 60 | if (items == null && itemsSource is IEnumerable list) 61 | items = list.Cast().ToList(); 62 | 63 | if (items != null) 64 | { 65 | var textValues = items as IEnumerable; 66 | if (textValues == null && items.Count > 0 && items[0] is string) 67 | textValues = items.Cast(); 68 | 69 | if (textValues != null) 70 | { 71 | Children = new List(textValues.Select(child => new SegmentedControlOption {Text = child})); 72 | OnSelectedItemChanged(true); 73 | } 74 | else 75 | { 76 | var textPropertyName = TextPropertyName; 77 | if (textPropertyName != null) 78 | { 79 | var newChildren = new List(); 80 | foreach (var item in items) 81 | newChildren.Add(new SegmentedControlOption { Item = item, TextPropertyName = textPropertyName }); 82 | Children = newChildren; 83 | OnSelectedItemChanged(true); 84 | } 85 | } 86 | } 87 | } 88 | 89 | protected override void OnPropertyChanged(string propertyName = null) 90 | { 91 | base.OnPropertyChanged(propertyName); 92 | 93 | if (propertyName == nameof(ItemsSource) || propertyName == nameof(TextPropertyName)) 94 | OnItemsSourceChanged(); 95 | else if(propertyName == nameof(SelectedItem)) 96 | OnSelectedItemChanged(); 97 | else if(propertyName == nameof(SelectedSegment)) 98 | OnSelectedSegmentChanged(); 99 | } 100 | 101 | private void OnSelectedSegmentChanged() 102 | { 103 | var segmentIndex = SelectedSegment; 104 | if (segmentIndex >= 0 && segmentIndex < Children.Count && SelectedItem != Children[segmentIndex].Item) 105 | SelectedItem = Children[segmentIndex].Item; 106 | } 107 | 108 | private void OnSelectedItemChanged(bool forceUpdateSelectedSegment = false) 109 | { 110 | if (TextPropertyName != null) 111 | { 112 | var selectedItem = SelectedItem; 113 | var selectedIndex = Children.IndexOf(item => item.Item == selectedItem); 114 | if (selectedIndex == -1) 115 | { 116 | selectedIndex = SelectedSegment; 117 | if (selectedIndex < 0 || selectedIndex >= Children.Count) 118 | SelectedSegment = 0; 119 | else if(SelectedSegment != selectedIndex) 120 | SelectedSegment = selectedIndex; 121 | else if(forceUpdateSelectedSegment) 122 | OnSelectedSegmentChanged(); 123 | } 124 | else if (selectedIndex != SelectedSegment) 125 | SelectedSegment = selectedIndex; 126 | } 127 | } 128 | 129 | public IEnumerable ItemsSource 130 | { 131 | get => (IEnumerable)GetValue(ItemsSourceProperty); 132 | set => SetValue(ItemsSourceProperty, value); 133 | } 134 | 135 | public string TextPropertyName 136 | { 137 | get => (string)GetValue(TextPropertyNameProperty); 138 | set => SetValue(TextPropertyNameProperty, value); 139 | } 140 | #endregion 141 | 142 | public static readonly BindableProperty TextColorProperty = BindableProperty.Create( 143 | propertyName: "TextColor", 144 | returnType: typeof(Color), 145 | declaringType: typeof(SegmentedControl), 146 | defaultValue: default(Color)); 147 | 148 | public Color TextColor 149 | { 150 | get => (Color) GetValue(TextColorProperty); 151 | set => SetValue(TextColorProperty, value); 152 | } 153 | 154 | public static readonly BindableProperty TintColorProperty = BindableProperty.Create(nameof(TintColor), typeof(Color), typeof(SegmentedControl), Color.Blue); 155 | 156 | public Color TintColor 157 | { 158 | get => (Color)GetValue(TintColorProperty); 159 | set => SetValue(TintColorProperty, value); 160 | } 161 | 162 | public static readonly BindableProperty SelectedTextColorProperty = BindableProperty.Create(nameof(SelectedTextColor), typeof(Color), typeof(SegmentedControl), Color.White); 163 | 164 | public Color SelectedTextColor 165 | { 166 | get => (Color)GetValue(SelectedTextColorProperty); 167 | set => SetValue(SelectedTextColorProperty, value); 168 | } 169 | 170 | public static readonly BindableProperty DisabledColorProperty = BindableProperty.Create(nameof(DisabledColor), typeof(Color), typeof(SegmentedControl), Color.Gray); 171 | 172 | public Color DisabledColor 173 | { 174 | get => (Color)GetValue(DisabledColorProperty); 175 | set => SetValue(DisabledColorProperty, value); 176 | } 177 | 178 | public static readonly BindableProperty BorderColorProperty = BindableProperty.Create(nameof(BorderColor), typeof(Color), typeof(SegmentedControl), defaultValueCreator: bindable => ((SegmentedControl)bindable).TintColor); 179 | 180 | public Color BorderColor 181 | { 182 | get => (Color)GetValue(BorderColorProperty); 183 | set => SetValue(BorderColorProperty, value); 184 | } 185 | 186 | public static readonly BindableProperty BorderWidthProperty = BindableProperty.Create(nameof(BorderWidth), typeof(double), typeof(SegmentedControl), defaultValueCreator: _ => Device.RuntimePlatform == Device.Android ? 1.0 : 0.0); 187 | 188 | public double BorderWidth 189 | { 190 | get => (double)GetValue(BorderWidthProperty); 191 | set => SetValue(BorderWidthProperty, value); 192 | } 193 | 194 | public static readonly BindableProperty SelectedSegmentProperty = BindableProperty.Create(nameof(SelectedSegment), typeof(int), typeof(SegmentedControl), 0); 195 | public static readonly BindableProperty SelectedItemProperty = BindableProperty.Create(nameof(SelectedItem), typeof(object), typeof(SegmentedControl), defaultBindingMode: BindingMode.TwoWay); 196 | 197 | public int SelectedSegment 198 | { 199 | get => (int)GetValue(SelectedSegmentProperty); 200 | set => SetValue(SelectedSegmentProperty, value); 201 | } 202 | 203 | public object SelectedItem 204 | { 205 | get => (object)GetValue(SelectedItemProperty); 206 | set => SetValue(SelectedItemProperty, value); 207 | } 208 | 209 | 210 | public static readonly BindableProperty SegmentSelectedCommandProperty = BindableProperty.Create(nameof(SegmentSelectedCommand), typeof(ICommand), typeof(SegmentedControl)); 211 | public ICommand SegmentSelectedCommand 212 | { 213 | get => (ICommand)GetValue(SegmentSelectedCommandProperty); 214 | set => SetValue(SegmentSelectedCommandProperty, value); 215 | } 216 | 217 | public static readonly BindableProperty SegmentSelectedCommandParameterProperty = BindableProperty.Create(nameof(SegmentSelectedCommandParameter), typeof(object), typeof(SegmentedControl)); 218 | 219 | 220 | public object SegmentSelectedCommandParameter 221 | { 222 | get => GetValue(SegmentSelectedCommandParameterProperty); 223 | set => SetValue(SegmentSelectedCommandParameterProperty, value); 224 | } 225 | 226 | public static readonly BindableProperty FontSizeProperty = BindableProperty.Create(nameof(FontSize), typeof(double), typeof(SegmentedControl), Device.GetNamedSize(NamedSize.Medium, typeof(Label))); 227 | [Xamarin.Forms.TypeConverter(typeof(FontSizeConverter))] 228 | public double FontSize 229 | { 230 | get => (double)GetValue(FontSizeProperty); 231 | set => SetValue(FontSizeProperty, value); 232 | } 233 | 234 | public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(SegmentedControl)); 235 | public string FontFamily 236 | { 237 | get => (string)GetValue(FontFamilyProperty); 238 | set => SetValue(FontFamilyProperty, value); 239 | } 240 | 241 | 242 | [EditorBrowsable(EditorBrowsableState.Never)] 243 | public void RaiseSelectionChanged() 244 | { 245 | OnSegmentSelected?.Invoke(this, new SegmentSelectEventArgs { NewValue = this.SelectedSegment }); 246 | 247 | if (!(SegmentSelectedCommand is null) && SegmentSelectedCommand.CanExecute(SegmentSelectedCommandParameter)) 248 | { 249 | SegmentSelectedCommand.Execute(SegmentSelectedCommandParameter); 250 | } 251 | } 252 | 253 | protected override void OnBindingContextChanged() 254 | { 255 | base.OnBindingContextChanged(); 256 | 257 | if (!(Children is null)) 258 | { 259 | foreach (var segment in Children) 260 | { 261 | segment.BindingContext = BindingContext; 262 | } 263 | } 264 | } 265 | } 266 | } 267 | -------------------------------------------------------------------------------- /src/main/SegCtlr.Netstandard/Control/SegmentedControlOption.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using Xamarin.Forms; 4 | 5 | namespace Plugin.Segmented.Control 6 | { 7 | [Preserve(AllMembers = true)] 8 | public class SegmentedControlOption : View 9 | { 10 | public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(SegmentedControlOption), string.Empty); 11 | public static readonly BindableProperty ItemProperty = BindableProperty.Create(nameof(Item), typeof(object), typeof(SegmentedControlOption), propertyChanged: (bindable, value, newValue) => ((SegmentedControlOption)bindable).OnItemChanged(value, newValue)); 12 | public static readonly BindableProperty TextPropertyNameProperty = BindableProperty.Create(nameof(TextPropertyName), typeof(string), typeof(SegmentedControlOption)); 13 | 14 | public string Text 15 | { 16 | get => (string)GetValue(TextProperty); 17 | set => SetValue(TextProperty, value); 18 | } 19 | 20 | public object Item 21 | { 22 | get => GetValue(ItemProperty); 23 | set => SetValue(ItemProperty, value); 24 | } 25 | 26 | public string TextPropertyName 27 | { 28 | get => (string)GetValue(TextPropertyNameProperty); 29 | set => SetValue(TextPropertyNameProperty, value); 30 | } 31 | 32 | private void OnItemChanged(object value, object newValue) 33 | { 34 | if (value is INotifyPropertyChanged mutableItem) 35 | mutableItem.PropertyChanged -= OnItemPropertyChanged; 36 | if (newValue is INotifyPropertyChanged newMutableItem) 37 | newMutableItem.PropertyChanged += OnItemPropertyChanged; 38 | } 39 | 40 | protected override void OnPropertyChanged(string propertyName = null) 41 | { 42 | base.OnPropertyChanged(propertyName); 43 | 44 | if (propertyName == nameof(Item) || propertyName == nameof(TextPropertyName)) 45 | SetTextFromItemProperty(); 46 | } 47 | 48 | private void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e) 49 | { 50 | if(e.PropertyName == TextPropertyName) 51 | SetTextFromItemProperty(); 52 | } 53 | 54 | private void SetTextFromItemProperty() 55 | { 56 | if (Item != null && TextPropertyName != null) 57 | Text = Item.GetType().GetProperty(TextPropertyName)?.GetValue(Item)?.ToString(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/SegCtlr.Netstandard/Event/ElementChildrenChanging.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Plugin.Segmented.Control; 4 | 5 | namespace Plugin.Segmented.Event 6 | { 7 | 8 | [Preserve(AllMembers = true)] 9 | public class ElementChildrenChanging : EventArgs 10 | { 11 | public ElementChildrenChanging(IList oldValues, IList newValues) 12 | { 13 | OldValues = oldValues; 14 | NewValues = newValues; 15 | } 16 | public IList OldValues { get; } 17 | public IList NewValues { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/SegCtlr.Netstandard/Event/SegmentSelectEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Plugin.Segmented.Event 4 | { 5 | [Preserve(AllMembers = true)] 6 | public class SegmentSelectEventArgs : EventArgs 7 | { 8 | public int NewValue { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/SegCtlr.Netstandard/PreserveAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Plugin.Segmented 4 | { 5 | public sealed class PreserveAttribute : Attribute 6 | { 7 | public bool AllMembers; 8 | public bool Conditional; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/SegCtlr.Netstandard/SegCtlr.Netstandard.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | Plugin.Segmented 6 | Plugin.Segmented 7 | 5.5.0.0 8 | 5.5.0.0 9 | Debug;Release;DebugNative 10 | true 11 | true 12 | true 13 | snupkg 14 | portable 15 | 16 | 17 | 18 | true 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/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 you 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 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Android.App; 4 | using Android.Content.PM; 5 | using Android.Runtime; 6 | using Android.Views; 7 | using Android.Widget; 8 | using Android.OS; 9 | 10 | namespace Test.SegmentedControl.Droid 11 | { 12 | [Activity(Label = "Test.SegmentedControl", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 13 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 14 | { 15 | protected override void OnCreate(Bundle bundle) 16 | { 17 | TabLayoutResource = Resource.Layout.Tabbar; 18 | ToolbarResource = Resource.Layout.Toolbar; 19 | 20 | base.OnCreate(bundle); 21 | 22 | global::Xamarin.Forms.Forms.Init(this, bundle); 23 | LoadApplication(new App()); 24 | } 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Android.App; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Test.SegmentedControl.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Test.SegmentedControl.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | 32 | // Add some common permissions, these can be removed if not needed 33 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)] 34 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)] 35 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/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.xml), 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-hdpi/ 12 | icon.png 13 | 14 | drawable-ldpi/ 15 | icon.png 16 | 17 | drawable-mdpi/ 18 | icon.png 19 | 20 | layout/ 21 | main.xml 22 | 23 | values/ 24 | strings.xml 25 | 26 | In order to get the build system to recognize Android resources, set the build action to 27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 28 | instead operate on resource IDs. When you compile an Android application that uses resources, 29 | the build system will package the resources for distribution and generate a class called 30 | "Resource" that contains the tokens for each one of the resources included. For example, 31 | for the above Resources layout, this is what the Resource class would expose: 32 | 33 | public class Resource { 34 | public class drawable { 35 | public const int icon = 0x123; 36 | } 37 | 38 | public class layout { 39 | public const int main = 0x456; 40 | } 41 | 42 | public class strings { 43 | public const int first_string = 0xabc; 44 | public const int second_string = 0xbcd; 45 | } 46 | } 47 | 48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main 49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first 50 | string in the dictionary file values/strings.xml. 51 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/Resources/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.Android/Resources/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/Resources/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.Android/Resources/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/Resources/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.Android/Resources/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/Resources/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.Android/Resources/drawable/icon.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/Resources/font/comicsaaaans.xml: -------------------------------------------------------------------------------- 1 |  2 | 4 | 5 | 6 | 14 | 15 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/Resources/layout/Tabbar.axml: -------------------------------------------------------------------------------- 1 | 2 | 12 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/Resources/layout/Toolbar.axml: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 26 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using Windows.ApplicationModel; 5 | using Windows.ApplicationModel.Activation; 6 | using Windows.UI.Xaml; 7 | using Windows.UI.Xaml.Controls; 8 | using Windows.UI.Xaml.Navigation; 9 | using Plugin.Segmented.Control.UWP; 10 | 11 | namespace Test.SegmentedControl.UWP 12 | { 13 | /// 14 | /// Provides application-specific behavior to supplement the default Application class. 15 | /// 16 | sealed partial class App : Application 17 | { 18 | /// 19 | /// Initializes the singleton application object. This is the first line of authored code 20 | /// executed, and as such is the logical equivalent of main() or WinMain(). 21 | /// 22 | public App() 23 | { 24 | this.InitializeComponent(); 25 | this.Suspending += OnSuspending; 26 | } 27 | 28 | /// 29 | /// Invoked when the application is launched normally by the end user. Other entry points 30 | /// will be used such as when the application is launched to open a specific file. 31 | /// 32 | /// Details about the launch request and process. 33 | protected override void OnLaunched(LaunchActivatedEventArgs e) 34 | { 35 | #if DEBUG 36 | if (System.Diagnostics.Debugger.IsAttached) 37 | { 38 | this.DebugSettings.EnableFrameRateCounter = true; 39 | } 40 | #endif 41 | 42 | Frame rootFrame = Window.Current.Content as Frame; 43 | 44 | // Do not repeat app initialization when the Window already has content, 45 | // just ensure that the window is active 46 | if (rootFrame == null) 47 | { 48 | // Create a Frame to act as the navigation context and navigate to the first page 49 | rootFrame = new Frame(); 50 | 51 | rootFrame.NavigationFailed += OnNavigationFailed; 52 | 53 | var assembliesToInclude = new List {typeof(SegmentedControlRenderer).GetTypeInfo().Assembly}; 54 | 55 | Xamarin.Forms.Forms.Init(e, assembliesToInclude); 56 | 57 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 58 | { 59 | //TODO: Load state from previously suspended application 60 | } 61 | 62 | // Place the frame in the current Window 63 | Window.Current.Content = rootFrame; 64 | } 65 | 66 | if (rootFrame.Content == null) 67 | { 68 | // When the navigation stack isn't restored navigate to the first page, 69 | // configuring the new page by passing required information as a navigation 70 | // parameter 71 | rootFrame.Navigate(typeof(MainPage), e.Arguments); 72 | } 73 | // Ensure the current window is active 74 | Window.Current.Activate(); 75 | } 76 | 77 | /// 78 | /// Invoked when Navigation to a certain page fails 79 | /// 80 | /// The Frame which failed navigation 81 | /// Details about the navigation failure 82 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 83 | { 84 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 85 | } 86 | 87 | /// 88 | /// Invoked when application execution is being suspended. Application state is saved 89 | /// without knowing whether the application will be terminated or resumed with the contents 90 | /// of memory still intact. 91 | /// 92 | /// The source of the suspend request. 93 | /// Details about the suspend request. 94 | private void OnSuspending(object sender, SuspendingEventArgs e) 95 | { 96 | var deferral = e.SuspendingOperation.GetDeferral(); 97 | //TODO: Save application state and stop any background activity 98 | deferral.Complete(); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/LockScreenLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/LockScreenLogo.scale-100.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/LockScreenLogo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/LockScreenLogo.scale-125.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/LockScreenLogo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/LockScreenLogo.scale-150.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/LockScreenLogo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/LockScreenLogo.scale-400.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/SplashScreen.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/SplashScreen.scale-100.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/SplashScreen.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/SplashScreen.scale-125.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/SplashScreen.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/SplashScreen.scale-150.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/SplashScreen.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/SplashScreen.scale-400.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square150x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square150x150Logo.scale-100.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square150x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square150x150Logo.scale-125.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square150x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square150x150Logo.scale-150.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square150x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square150x150Logo.scale-400.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.scale-100.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.scale-125.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.scale-150.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.scale-400.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.targetsize-16_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.targetsize-16_altform-unplated.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.targetsize-256_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.targetsize-256_altform-unplated.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.targetsize-32_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.targetsize-32_altform-unplated.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.targetsize-48_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Square44x44Logo.targetsize-48_altform-unplated.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Wide310x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Wide310x150Logo.scale-100.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Wide310x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Wide310x150Logo.scale-125.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Wide310x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Wide310x150Logo.scale-150.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Assets/Wide310x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.UWP/Assets/Wide310x150Logo.scale-400.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.Foundation; 7 | using Windows.Foundation.Collections; 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Controls; 10 | using Windows.UI.Xaml.Controls.Primitives; 11 | using Windows.UI.Xaml.Data; 12 | using Windows.UI.Xaml.Input; 13 | using Windows.UI.Xaml.Media; 14 | using Windows.UI.Xaml.Navigation; 15 | 16 | namespace Test.SegmentedControl.UWP 17 | { 18 | public sealed partial class MainPage 19 | { 20 | public MainPage() 21 | { 22 | this.InitializeComponent(); 23 | 24 | LoadApplication(new Test.SegmentedControl.App()); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | Test.SegmentedControl.UWP 18 | jaspe 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Test.SegmentedControl.UWP")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Test.SegmentedControl.UWP")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.UWP/Test.SegCtlr.UWP.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x86 7 | {D133A400-6A9B-4414-A989-6165FF3A3BAC} 8 | AppContainerExe 9 | Properties 10 | Test.SegmentedControl.UWP 11 | Test.SegmentedControl.UWP 12 | en-US 13 | UAP 14 | 10.0.19041.0 15 | 10.0.16299.0 16 | 14 17 | true 18 | 512 19 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 20 | Test.SegmentedControl.UWP_TemporaryKey.pfx 21 | win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot 22 | 23 | 24 | true 25 | bin\ARM\Debug\ 26 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 27 | ;2008 28 | full 29 | ARM 30 | false 31 | prompt 32 | true 33 | 34 | 35 | bin\ARM\Release\ 36 | TRACE;NETFX_CORE;WINDOWS_UWP 37 | true 38 | ;2008 39 | pdbonly 40 | ARM 41 | false 42 | prompt 43 | true 44 | true 45 | 46 | 47 | true 48 | bin\x64\Debug\ 49 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 50 | ;2008 51 | full 52 | x64 53 | false 54 | prompt 55 | true 56 | 57 | 58 | bin\x64\Release\ 59 | TRACE;NETFX_CORE;WINDOWS_UWP 60 | true 61 | ;2008 62 | pdbonly 63 | x64 64 | false 65 | prompt 66 | true 67 | true 68 | 69 | 70 | true 71 | bin\x86\Debug\ 72 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 73 | ;2008 74 | full 75 | x86 76 | false 77 | prompt 78 | true 79 | 80 | 81 | bin\x86\Release\ 82 | TRACE;NETFX_CORE;WINDOWS_UWP 83 | true 84 | ;2008 85 | pdbonly 86 | x86 87 | false 88 | prompt 89 | true 90 | true 91 | 92 | 93 | 94 | App.xaml 95 | 96 | 97 | MainPage.xaml 98 | 99 | 100 | 101 | 102 | 103 | Designer 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | MSBuild:Compile 144 | Designer 145 | 146 | 147 | MSBuild:Compile 148 | Designer 149 | 150 | 151 | 152 | 153 | {2848d7d8-3c18-4df0-8638-cbccc36a325b} 154 | SegCtrl.UWP 155 | 156 | 157 | {aba23bab-084a-443e-b9cc-37b0a826377e} 158 | SegCtlr.Netstandard 159 | 160 | 161 | {085d550d-9e27-474f-a79e-4578224f8664} 162 | Test.SegCtrl.netstandard 163 | 164 | 165 | 166 | 167 | 6.2.13 168 | 169 | 170 | 5.0.0.2291 171 | 172 | 173 | 174 | 14.0 175 | 176 | 177 | bin\ARM\DebugNAtive\ 178 | TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS 179 | true 180 | ;2008 181 | true 182 | pdbonly 183 | ARM 184 | false 185 | prompt 186 | MinimumRecommendedRules.ruleset 187 | true 188 | 189 | 190 | bin\x64\DebugNAtive\ 191 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;CODE_ANALYSIS 192 | false 193 | ;2008 194 | true 195 | pdbonly 196 | x64 197 | false 198 | prompt 199 | MinimumRecommendedRules.ruleset 200 | true 201 | true 202 | true 203 | 204 | 205 | bin\x86\DebugNAtive\ 206 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;CODE_ANALYSIS 207 | false 208 | ;2008 209 | true 210 | pdbonly 211 | x86 212 | false 213 | prompt 214 | MinimumRecommendedRules.ruleset 215 | true 216 | true 217 | true 218 | 219 | 220 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | using Plugin.Segmented.Control.iOS; 3 | using Test.SegmentedControl; 4 | using UIKit; 5 | 6 | namespace Test.Segmented.Control.iOS 7 | { 8 | // The UIApplicationDelegate for the application. This class is responsible for launching the 9 | // User Interface of the application, as well as listening (and optionally responding) to 10 | // application events from iOS. 11 | [Register("AppDelegate")] 12 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 13 | { 14 | // 15 | // This method is invoked when the application has loaded and is ready to run. In this 16 | // method you should instantiate the window, load the UI into it and then make the window 17 | // visible. 18 | // 19 | // You have 17 seconds to return from this method, or iOS will terminate your application. 20 | // 21 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 22 | { 23 | global::Xamarin.Forms.Forms.Init(); 24 | 25 | SegmentedControlRenderer.Initialize(); 26 | 27 | LoadApplication(new App()); 28 | 29 | return base.FinishedLaunching(app, options); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Info.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | UIDeviceFamily 6 | 7 | 1 8 | 2 9 | 10 | UISupportedInterfaceOrientations 11 | 12 | UIInterfaceOrientationPortrait 13 | UIInterfaceOrientationLandscapeLeft 14 | UIInterfaceOrientationLandscapeRight 15 | 16 | UISupportedInterfaceOrientations~ipad 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationPortraitUpsideDown 20 | UIInterfaceOrientationLandscapeLeft 21 | UIInterfaceOrientationLandscapeRight 22 | 23 | MinimumOSVersion 24 | 8.0 25 | CFBundleDisplayName 26 | Test.SegmentedControl 27 | CFBundleIdentifier 28 | com.yourcompany.Test.SegmentedControl 29 | CFBundleVersion 30 | 1.0 31 | CFBundleIconFiles 32 | 33 | Icon-60@2x 34 | Icon-60@3x 35 | Icon-76 36 | Icon-76@2x 37 | Default 38 | Default@2x 39 | Default-568h@2x 40 | Default-Portrait 41 | Default-Portrait@2x 42 | Icon-Small-40 43 | Icon-Small-40@2x 44 | Icon-Small-40@3x 45 | Icon-Small 46 | Icon-Small@2x 47 | Icon-Small@3x 48 | 49 | UILaunchStoryboardName 50 | LaunchScreen 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using UIKit; 2 | 3 | namespace Test.Segmented.Control.iOS 4 | { 5 | public class Application 6 | { 7 | // This is the main entry point of the application. 8 | static void Main(string[] args) 9 | { 10 | // if you want to use a different Application Delegate class from "AppDelegate" 11 | // you can specify it here. 12 | UIApplication.Main(args, null, typeof(AppDelegate)); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Test.SegmentedControl.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Test.SegmentedControl.iOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Default.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Icon-60@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Icon-60@3x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Icon-76.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Icon-76@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Icon-Small-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Icon-Small-40.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Icon-Small-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Icon-Small-40@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Icon-Small-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Icon-Small-40@3x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Icon-Small.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Icon-Small@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/Resources/Icon-Small@3x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Resources/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/Test.SegCtlr.iOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | iPhoneSimulator 6 | 8.0.30703 7 | 2.0 8 | {2C3B781D-170C-44FA-BB73-E454A4AE73BD} 9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | Exe 11 | Test.Segmented.Control.iOS 12 | Resources 13 | Test.Segmented.Control.iOS 14 | 15 | 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\iPhoneSimulator\Debug 22 | DEBUG 23 | prompt 24 | 4 25 | false 26 | i386, x86_64 27 | None 28 | true 29 | 30 | 31 | none 32 | true 33 | bin\iPhoneSimulator\Release 34 | prompt 35 | 4 36 | None 37 | i386, x86_64 38 | false 39 | 40 | 41 | true 42 | full 43 | false 44 | bin\iPhone\Debug 45 | DEBUG 46 | prompt 47 | 4 48 | false 49 | ARMv7, ARM64 50 | iPhone Developer 51 | true 52 | Entitlements.plist 53 | 54 | 55 | none 56 | true 57 | bin\iPhone\Release 58 | prompt 59 | 4 60 | ARMv7, ARM64 61 | false 62 | iPhone Developer 63 | Entitlements.plist 64 | 65 | 66 | none 67 | True 68 | bin\iPhone\Ad-Hoc 69 | prompt 70 | 4 71 | False 72 | ARMv7, ARM64 73 | True 74 | Automatic:AdHoc 75 | iPhone Distribution 76 | Entitlements.plist 77 | 78 | 79 | none 80 | True 81 | bin\iPhone\AppStore 82 | prompt 83 | 4 84 | False 85 | ARMv7, ARM64 86 | Automatic:AppStore 87 | iPhone Distribution 88 | Entitlements.plist 89 | 90 | 91 | bin\iPhoneSimulator\DebugNAtive\ 92 | __UNIFIED__;__MOBILE__;__IOS__; 93 | true 94 | AnyCPU 95 | false 96 | prompt 97 | MinimumRecommendedRules.ruleset 98 | 99 | 100 | bin\iPhone\DebugNAtive\ 101 | __UNIFIED__;__MOBILE__;__IOS__; 102 | true 103 | AnyCPU 104 | false 105 | prompt 106 | MinimumRecommendedRules.ruleset 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | {39cd5d35-d98e-49a2-868b-89e7b64d25de} 147 | SegCtrl.iOS 148 | false 149 | false 150 | 151 | 152 | {aba23bab-084a-443e-b9cc-37b0a826377e} 153 | SegCtlr.Netstandard 154 | 155 | 156 | {085d550d-9e27-474f-a79e-4578224f8664} 157 | Test.SegCtrl.netstandard 158 | 159 | 160 | 161 | 162 | 5.0.0.2291 163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/iTunesArtwork: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/iTunesArtwork -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.iOS/iTunesArtwork@2x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.iOS/iTunesArtwork@2x -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using AppKit; 2 | using Foundation; 3 | using SegCtrl.macOS; 4 | using Test.SegmentedControl; 5 | 6 | namespace Test.SegCtrl.macOS 7 | { 8 | [Register("AppDelegate")] 9 | public class AppDelegate : global::Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate 10 | { 11 | NSWindow _window; 12 | public AppDelegate() 13 | { 14 | var style = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled; 15 | 16 | var rect = new CoreGraphics.CGRect(200, 200, 800, 600); 17 | _window = new NSWindow(rect, style, NSBackingStore.Buffered, false); 18 | _window.Title = "SegmentedControl Test on macOS"; 19 | } 20 | 21 | public override NSWindow MainWindow => _window; 22 | 23 | public override void DidFinishLaunching(NSNotification notification) 24 | { 25 | // Insert code here to initialize your application 26 | 27 | global::Xamarin.Forms.Forms.Init(); 28 | 29 | SegmentedControlRenderer.Initialize(); 30 | 31 | LoadApplication(new App()); 32 | base.DidFinishLaunching(notification); 33 | } 34 | 35 | public override void WillTerminate(NSNotification notification) 36 | { 37 | // Insert code here to tear down your application 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1iveowl/Plugin.SegmentedControl/6cd87f799e209e26e279786e00e663d790ef072a/src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "filename": "AppIcon-16.png", 5 | "size": "16x16", 6 | "scale": "1x", 7 | "idiom": "mac" 8 | }, 9 | { 10 | "filename": "AppIcon-16@2x.png", 11 | "size": "16x16", 12 | "scale": "2x", 13 | "idiom": "mac" 14 | }, 15 | { 16 | "filename": "AppIcon-32.png", 17 | "size": "32x32", 18 | "scale": "1x", 19 | "idiom": "mac" 20 | }, 21 | { 22 | "filename": "AppIcon-32@2x.png", 23 | "size": "32x32", 24 | "scale": "2x", 25 | "idiom": "mac" 26 | }, 27 | { 28 | "filename": "AppIcon-128.png", 29 | "size": "128x128", 30 | "scale": "1x", 31 | "idiom": "mac" 32 | }, 33 | { 34 | "filename": "AppIcon-128@2x.png", 35 | "size": "128x128", 36 | "scale": "2x", 37 | "idiom": "mac" 38 | }, 39 | { 40 | "filename": "AppIcon-256.png", 41 | "size": "256x256", 42 | "scale": "1x", 43 | "idiom": "mac" 44 | }, 45 | { 46 | "filename": "AppIcon-256@2x.png", 47 | "size": "256x256", 48 | "scale": "2x", 49 | "idiom": "mac" 50 | }, 51 | { 52 | "filename": "AppIcon-512.png", 53 | "size": "512x512", 54 | "scale": "1x", 55 | "idiom": "mac" 56 | }, 57 | { 58 | "filename": "AppIcon-512@2x.png", 59 | "size": "512x512", 60 | "scale": "2x", 61 | "idiom": "mac" 62 | } 63 | ], 64 | "info": { 65 | "version": 1, 66 | "author": "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleName 6 | Test.SegCtrl.macOS 7 | CFBundleIdentifier 8 | com.yourcompany.Test.SegmentedControl.Test-SegCtrl-macOS 9 | CFBundleShortVersionString 10 | 1.0 11 | CFBundleVersion 12 | 1 13 | LSMinimumSystemVersion 14 | 10.13 15 | CFBundleDevelopmentRegion 16 | en 17 | CFBundleInfoDictionaryVersion 18 | 6.0 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | NSHumanReadableCopyright 24 | Copyright 2018 25 | NSPrincipalClass 26 | NSApplication 27 | XSAppIconAssets 28 | Assets.xcassets/AppIcon.appiconset 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Main.cs: -------------------------------------------------------------------------------- 1 | using AppKit; 2 | 3 | namespace Test.SegCtrl.macOS 4 | { 5 | internal static class MainClass 6 | { 7 | private static void Main(string[] args) 8 | { 9 | NSApplication.Init(); 10 | NSApplication.SharedApplication.Delegate = new AppDelegate(); 11 | NSApplication.Main(args); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.macOS/Test.SegCtrl.macOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | iPhoneSimulator 7 | {F496EC17-11A7-43DD-ABD2-0EACB53BF553} 8 | {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 9 | Exe 10 | Test.SegCtrl.macOS 11 | Test.SegCtrl.macOS 12 | v2.0 13 | Xamarin.Mac 14 | Resources 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug 23 | DEBUG; 24 | prompt 25 | 4 26 | false 27 | Mac Developer 28 | false 29 | false 30 | false 31 | true 32 | true 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | pdbonly 42 | true 43 | bin\Release 44 | 45 | 46 | prompt 47 | 4 48 | false 49 | true 50 | false 51 | true 52 | true 53 | true 54 | SdkOnly 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 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 | 91 | 92 | {BF907E43-0F07-4502-9AF3-96B063281234} 93 | SegCtrl.macOS 94 | 95 | 96 | {085D550D-9E27-474F-A79E-4578224F8664} 97 | Test.SegCtrl.netstandard 98 | 99 | 100 | 101 | 102 | 5.0.0.2291 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.netstandard/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.netstandard/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Xamarin.Forms; 7 | 8 | namespace Test.SegmentedControl 9 | { 10 | public partial class App : Application 11 | { 12 | public App() 13 | { 14 | InitializeComponent(); 15 | 16 | MainPage = new Test.SegmentedControl.MainPage(); 17 | } 18 | 19 | protected override void OnStart() 20 | { 21 | // Handle when your app starts 22 | } 23 | 24 | protected override void OnSleep() 25 | { 26 | // Handle when your app sleeps 27 | } 28 | 29 | protected override void OnResume() 30 | { 31 | // Handle when your app resumes 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/Test.SegCtrl.netstandard/MainPage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |