├── .gitignore
├── Demo
├── App.cs
├── Demo.csproj
├── MainPage.xaml
├── MainPage.xaml.cs
├── SecondPage.xaml
└── SecondPage.xaml.cs
├── Droid
├── Assets
│ └── AboutAssets.txt
├── Demo.Droid.csproj
├── Demo.Droid.csproj.bak
├── DemoPage.xaml
├── DemoPage.xaml.cs
├── 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
│ ├── layout
│ │ ├── Tabbar.axml
│ │ └── Toolbar.axml
│ └── values
│ │ └── styles.xml
└── packages.config
├── README.md
├── SegmentedControl.sln
├── SegmentedControl.userprefs
├── SegmentedControl
├── SegmentedControl.FormsPlugin.Abstractions.Portable
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── SegmentedControl.FormsPlugin.Abstractions.Portable.csproj
│ └── packages.config
├── SegmentedControl.FormsPlugin.Abstractions
│ ├── SegmentedControl.FormsPlugin.Abstractions.csproj
│ └── SegmentedControl.cs
├── SegmentedControl.FormsPlugin.Android
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Resources
│ │ ├── AboutResources.txt
│ │ ├── Resource.Designer.cs
│ │ ├── 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
│ ├── SegmentedControl.FormsPlugin.Android.csproj
│ ├── SegmentedControlImplementation.cs
│ ├── bin
│ │ └── Release
│ │ │ └── SegmentedControl.FormsPlugin.Abstractions.xml
│ ├── obj
│ │ └── Release
│ │ │ ├── MonoAndroid,Version=v7.0.AssemblyAttribute.cs
│ │ │ ├── SegmentedControl.FormsPlugin.Android.csproj.FilesWrittenAbsolute.txt
│ │ │ ├── SegmentedControl.FormsPlugin.Android.dll.mdb
│ │ │ ├── SegmentedControl.FormsPlugin.Android.obj.Release.__AndroidLibraryProjects__.zip
│ │ │ ├── library_project_imports
│ │ │ ├── __res_name_case_map.txt
│ │ │ └── res
│ │ │ │ ├── color
│ │ │ │ └── segmented_control_text.xml
│ │ │ │ ├── drawable
│ │ │ │ ├── segmented_control_background.xml
│ │ │ │ ├── segmented_control_first_background.xml
│ │ │ │ └── segmented_control_last_background.xml
│ │ │ │ ├── layout
│ │ │ │ ├── radiobutton.xml
│ │ │ │ └── radiogroup.xml
│ │ │ │ └── values
│ │ │ │ └── colors.xml
│ │ │ └── sdks.cache
│ └── packages.config
├── SegmentedControl.FormsPlugin.UWP
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── SegmentedControl.FormsPlugin.UWP.rd.xml
│ ├── SegmentRadioButton.cs
│ ├── SegmentedControl.FormsPlugin.UWP.csproj
│ ├── SegmentedControl.FormsPlugin.UWP.csproj.user
│ ├── SegmentedControl.FormsPlugin.UWP.nuget.targets
│ ├── SegmentedControlImplementation.cs
│ ├── SegmentedRadioButtonStyle.xaml
│ ├── SegmentedUserControl.xaml
│ ├── SegmentedUserControl.xaml.cs
│ ├── obj
│ │ └── Debug
│ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ │ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ ├── project.json
│ └── project.lock.json
└── SegmentedControl.FormsPlugin.iOS
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── SegmentedControl.FormsPlugin.iOS.csproj
│ ├── SegmentedControlImplementation.cs
│ └── packages.config
├── UWP
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── LockScreenLogo.scale-200.png
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ ├── Wide310x150Logo.scale-200.png
│ ├── c1.jpg
│ ├── c2.jpg
│ └── c3.jpg
├── Demo.UWP.csproj
├── MainPage.xaml
├── MainPage.xaml.cs
├── Package.appxmanifest
└── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── iOS
├── AppDelegate.cs
├── Assets.xcassets
│ ├── AppIcons.appiconset
│ │ └── Contents.json
│ └── Contents.json
├── Demo.iOS.csproj
├── Entitlements.plist
├── Info.plist
├── LaunchScreen.storyboard
├── Main.cs
└── packages.config
├── license.md
├── nuget
├── SegmentedControl.nuspec
├── lib
│ ├── Portable
│ │ └── SegmentedControl.FormsPlugin.Abstractions.dll
│ ├── SegmentedControl.FormsPlugin.Abstractions.dll
│ ├── SegmentedControl.FormsPlugin.Android.dll
│ ├── SegmentedControl.FormsPlugin.UWP.dll
│ ├── SegmentedControl.FormsPlugin.UWP.pri
│ ├── SegmentedControl.FormsPlugin.UWP.xr.xml
│ ├── SegmentedControl.FormsPlugin.iOS.dll
│ ├── SegmentedRadioButtonStyle.xbf
│ └── SegmentedUserControl.xbf
└── output
│ └── SegmentedControl.FormsPlugin.2.0.1.nupkg
└── packages
└── repositories.config
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 | *.VC.VC.opendb
85 |
86 | # Visual Studio profiler
87 | *.psess
88 | *.vsp
89 | *.vspx
90 | *.sap
91 |
92 | # TFS 2012 Local Workspace
93 | $tf/
94 |
95 | # Guidance Automation Toolkit
96 | *.gpState
97 |
98 | # ReSharper is a .NET coding add-in
99 | _ReSharper*/
100 | *.[Rr]e[Ss]harper
101 | *.DotSettings.user
102 |
103 | # JustCode is a .NET coding add-in
104 | .JustCode
105 |
106 | # TeamCity is a build add-in
107 | _TeamCity*
108 |
109 | # DotCover is a Code Coverage Tool
110 | *.dotCover
111 |
112 | # NCrunch
113 | _NCrunch_*
114 | .*crunch*.local.xml
115 | nCrunchTemp_*
116 |
117 | # MightyMoose
118 | *.mm.*
119 | AutoTest.Net/
120 |
121 | # Web workbench (sass)
122 | .sass-cache/
123 |
124 | # Installshield output folder
125 | [Ee]xpress/
126 |
127 | # DocProject is a documentation generator add-in
128 | DocProject/buildhelp/
129 | DocProject/Help/*.HxT
130 | DocProject/Help/*.HxC
131 | DocProject/Help/*.hhc
132 | DocProject/Help/*.hhk
133 | DocProject/Help/*.hhp
134 | DocProject/Help/Html2
135 | DocProject/Help/html
136 |
137 | # Click-Once directory
138 | publish/
139 |
140 | # Publish Web Output
141 | *.[Pp]ublish.xml
142 | *.azurePubxml
143 | # TODO: Comment the next line if you want to checkin your web deploy settings
144 | # but database connection strings (with potential passwords) will be unencrypted
145 | *.pubxml
146 | *.publishproj
147 |
148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
149 | # checkin your Azure Web App publish settings, but sensitive information contained
150 | # in these scripts will be unencrypted
151 | PublishScripts/
152 |
153 | # NuGet Packages
154 | # *.nupkg
155 | # The packages folder can be ignored because of Package Restore
156 | **/packages/*
157 | # except build/, which is used as an MSBuild target.
158 | !**/packages/build/
159 | # Uncomment if necessary however generally it will be regenerated when needed
160 | #!**/packages/repositories.config
161 | # NuGet v3's project.json files produces more ignoreable files
162 | *.nuget.props
163 | *.nuget.targets
164 |
165 | # Microsoft Azure Build Output
166 | csx/
167 | *.build.csdef
168 |
169 | # Microsoft Azure Emulator
170 | ecf/
171 | rcf/
172 |
173 | # Windows Store app package directories and files
174 | AppPackages/
175 | BundleArtifacts/
176 | Package.StoreAssociation.xml
177 | _pkginfo.txt
178 |
179 | # Visual Studio cache files
180 | # files ending in .cache can be ignored
181 | *.[Cc]ache
182 | # but keep track of directories ending in .cache
183 | !*.[Cc]ache/
184 |
185 | # Others
186 | ClientBin/
187 | ~$*
188 | *~
189 | *.dbmdl
190 | *.dbproj.schemaview
191 | *.pfx
192 | *.publishsettings
193 | node_modules/
194 | orleans.codegen.cs
195 |
196 | # Since there are multiple workflows, uncomment next line to ignore bower_components
197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198 | #bower_components/
199 |
200 | # RIA/Silverlight projects
201 | Generated_Code/
202 |
203 | # Backup & report files from converting an old project file
204 | # to a newer Visual Studio version. Backup files are not needed,
205 | # because we have git ;-)
206 | _UpgradeReport_Files/
207 | Backup*/
208 | UpgradeLog*.XML
209 | UpgradeLog*.htm
210 |
211 | # SQL Server files
212 | *.mdf
213 | *.ldf
214 |
215 | # Business Intelligence projects
216 | *.rdl.data
217 | *.bim.layout
218 | *.bim_*.settings
219 |
220 | # Microsoft Fakes
221 | FakesAssemblies/
222 |
223 | # GhostDoc plugin setting file
224 | *.GhostDoc.xml
225 |
226 | # Node.js Tools for Visual Studio
227 | .ntvs_analysis.dat
228 |
229 | # Visual Studio 6 build log
230 | *.plg
231 |
232 | # Visual Studio 6 workspace options file
233 | *.opt
234 |
235 | # Visual Studio LightSwitch build output
236 | **/*.HTMLClient/GeneratedArtifacts
237 | **/*.DesktopClient/GeneratedArtifacts
238 | **/*.DesktopClient/ModelManifest.xml
239 | **/*.Server/GeneratedArtifacts
240 | **/*.Server/ModelManifest.xml
241 | _Pvt_Extensions
242 |
243 | # Paket dependency manager
244 | .paket/paket.exe
245 | paket-files/
246 |
247 | # FAKE - F# Make
248 | .fake/
249 |
250 | # JetBrains Rider
251 | .idea/
252 | *.sln.iml
253 |
--------------------------------------------------------------------------------
/Demo/App.cs:
--------------------------------------------------------------------------------
1 | using Xamarin.Forms;
2 | using Xamarin.Forms.Xaml;
3 |
4 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)]
5 | namespace Demo
6 | {
7 | public class App : Application
8 | {
9 | public App()
10 | {
11 | // The root page of your application
12 | MainPage = new NavigationPage(new MainPage());
13 | }
14 |
15 | protected override void OnStart()
16 | {
17 | // Handle when your app starts
18 | }
19 |
20 | protected override void OnSleep()
21 | {
22 | // Handle when your app sleeps
23 | }
24 |
25 | protected override void OnResume()
26 | {
27 | // Handle when your app resumes
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Demo/Demo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | 1.2.4
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Demo/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Demo/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using SegmentedControl.FormsPlugin.Abstractions;
5 | using Xamarin.Forms;
6 |
7 | namespace Demo
8 | {
9 | public partial class MainPage : ContentPage
10 | {
11 | public MainPage()
12 | {
13 | InitializeComponent();
14 |
15 | Title = "Segmented Control";
16 |
17 | ToolbarItems.Add(new ToolbarItem() { Text = "Navigate", Command = new Command((obj) => {
18 | Navigation.PushAsync(new SecondPage());
19 | })});
20 | }
21 |
22 | void Handle_ValueChanged(object sender, SegmentedControl.FormsPlugin.Abstractions.ValueChangedEventArgs e)
23 | {
24 | switch (e.NewValue)
25 | {
26 | case 0:
27 | SegContent.Children.Clear();
28 | SegContent.Children.Add(new Label() { Text = "Items tab selected" });
29 | break;
30 | case 1:
31 | SegContent.Children.Clear();
32 | SegContent.Children.Add(new Label() { Text = "Notes tab selected" });
33 | break;
34 | case 2:
35 | SegContent.Children.Clear();
36 | SegContent.Children.Add(new Label() { Text = "Approvers tab selected" });
37 | break;
38 | case 3:
39 | SegContent.Children.Clear();
40 | SegContent.Children.Add(new Label() { Text = "Attachments tab selected" });
41 | break;
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Demo/SecondPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Demo/SecondPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using Xamarin.Forms;
5 |
6 | namespace Demo
7 | {
8 | public partial class SecondPage : ContentPage
9 | {
10 | public SecondPage()
11 | {
12 | InitializeComponent();
13 |
14 | Title = "Second Page";
15 | }
16 |
17 | void Handle_ValueChanged(object sender, SegmentedControl.FormsPlugin.Abstractions.ValueChangedEventArgs e)
18 | {
19 | switch (e.NewValue)
20 | {
21 | case 0:
22 | SegContent.Children.Clear();
23 | SegContent.Children.Add(new Label() { Text = "Items tab selected" });
24 | break;
25 | case 1:
26 | SegContent.Children.Clear();
27 | SegContent.Children.Add(new Label() { Text = "Notes tab selected" });
28 | break;
29 | case 2:
30 | SegContent.Children.Clear();
31 | SegContent.Children.Add(new Label() { Text = "Approvers tab selected" });
32 | break;
33 | case 3:
34 | SegContent.Children.Clear();
35 | SegContent.Children.Add(new Label() { Text = "Attachments tab selected" });
36 | break;
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Droid/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories) and given a Build Action of "AndroidAsset".
3 |
4 | These files will be deployed with your package and will be accessible using Android's
5 | AssetManager, like this:
6 |
7 | public class ReadAsset : Activity
8 | {
9 | protected override void OnCreate (Bundle bundle)
10 | {
11 | base.OnCreate (bundle);
12 |
13 | InputStream input = Assets.Open ("my_asset.txt");
14 | }
15 | }
16 |
17 | Additionally, some Android functions will automatically load asset files:
18 |
19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
20 |
--------------------------------------------------------------------------------
/Droid/Demo.Droid.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {80C7503B-92FB-4847-978C-A37AD2139767}
8 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
9 | Library
10 | Demo.Droid
11 | Demo.Droid
12 | v7.1
13 | True
14 | Resources\Resource.designer.cs
15 | Resource
16 | Properties\AndroidManifest.xml
17 | Resources
18 | Assets
19 | true
20 | false
21 | 1.2.4
22 |
23 |
24 | true
25 | full
26 | false
27 | bin\Debug
28 | DEBUG;
29 | prompt
30 | 4
31 | false
32 | None
33 | false
34 | armeabi-v7a;x86
35 |
36 |
37 | true
38 | bin\Release
39 | prompt
40 | 4
41 | false
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | ..\packages\Xamarin.Android.Support.Annotations.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Annotations.dll
50 |
51 |
52 | ..\packages\Xamarin.Android.Support.Compat.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Compat.dll
53 |
54 |
55 | ..\packages\Xamarin.Android.Support.Core.UI.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Core.UI.dll
56 |
57 |
58 | ..\packages\Xamarin.Android.Support.Core.Utils.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Core.Utils.dll
59 |
60 |
61 | ..\packages\Xamarin.Android.Support.Media.Compat.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Media.Compat.dll
62 |
63 |
64 | ..\packages\Xamarin.Android.Support.Fragment.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Fragment.dll
65 |
66 |
67 | ..\packages\Xamarin.Android.Support.Transition.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Transition.dll
68 |
69 |
70 | ..\packages\Xamarin.Android.Support.v4.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v4.dll
71 |
72 |
73 | ..\packages\Xamarin.Android.Support.v7.CardView.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.CardView.dll
74 |
75 |
76 | ..\packages\Xamarin.Android.Support.v7.Palette.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.Palette.dll
77 |
78 |
79 | ..\packages\Xamarin.Android.Support.v7.RecyclerView.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.RecyclerView.dll
80 |
81 |
82 | ..\packages\Xamarin.Android.Support.Vector.Drawable.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.dll
83 |
84 |
85 | ..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.dll
86 |
87 |
88 | ..\packages\Xamarin.Android.Support.v7.AppCompat.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.dll
89 |
90 |
91 | ..\packages\Xamarin.Android.Support.Design.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Design.dll
92 |
93 |
94 | ..\packages\Xamarin.Android.Support.v7.MediaRouter.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.MediaRouter.dll
95 |
96 |
97 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\FormsViewGroup.dll
98 |
99 |
100 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Core.dll
101 |
102 |
103 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll
104 |
105 |
106 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.dll
107 |
108 |
109 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll
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 | {AD2D2DB4-E781-4CF1-9B62-3AAD264F196D}
135 | SegmentedControl.FormsPlugin.Android
136 |
137 |
138 | {CDD2F7A1-0DED-481C-9C4D-4CD0CAE031B5}
139 | SegmentedControl.FormsPlugin.Abstractions
140 |
141 |
142 | {4A1D8886-EB55-4B3E-8F4B-1116463DC387}
143 | Demo
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
--------------------------------------------------------------------------------
/Droid/Demo.Droid.csproj.bak:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {80C7503B-92FB-4847-978C-A37AD2139767}
8 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
9 | Library
10 | Demo.Droid
11 | Demo.Droid
12 | v8.0
13 | True
14 | Resources\Resource.designer.cs
15 | Resource
16 | Properties\AndroidManifest.xml
17 | Resources
18 | Assets
19 | true
20 | false
21 | 1.2.4
22 |
23 |
24 | true
25 | full
26 | false
27 | bin\Debug
28 | DEBUG;
29 | prompt
30 | 4
31 | false
32 | None
33 | false
34 | armeabi-v7a;x86
35 |
36 |
37 | true
38 | bin\Release
39 | prompt
40 | 4
41 | false
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | ..\packages\Xamarin.Android.Support.Annotations.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Annotations.dll
50 |
51 |
52 | ..\packages\Xamarin.Android.Support.Compat.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Compat.dll
53 |
54 |
55 | ..\packages\Xamarin.Android.Support.Core.UI.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Core.UI.dll
56 |
57 |
58 | ..\packages\Xamarin.Android.Support.Core.Utils.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Core.Utils.dll
59 |
60 |
61 | ..\packages\Xamarin.Android.Support.Media.Compat.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Media.Compat.dll
62 |
63 |
64 | ..\packages\Xamarin.Android.Support.Fragment.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Fragment.dll
65 |
66 |
67 | ..\packages\Xamarin.Android.Support.Transition.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Transition.dll
68 |
69 |
70 | ..\packages\Xamarin.Android.Support.v4.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v4.dll
71 |
72 |
73 | ..\packages\Xamarin.Android.Support.v7.CardView.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.CardView.dll
74 |
75 |
76 | ..\packages\Xamarin.Android.Support.v7.Palette.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.Palette.dll
77 |
78 |
79 | ..\packages\Xamarin.Android.Support.v7.RecyclerView.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.RecyclerView.dll
80 |
81 |
82 | ..\packages\Xamarin.Android.Support.Vector.Drawable.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.dll
83 |
84 |
85 | ..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.dll
86 |
87 |
88 | ..\packages\Xamarin.Android.Support.v7.AppCompat.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.dll
89 |
90 |
91 | ..\packages\Xamarin.Android.Support.Design.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Design.dll
92 |
93 |
94 | ..\packages\Xamarin.Android.Support.v7.MediaRouter.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.MediaRouter.dll
95 |
96 |
97 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\FormsViewGroup.dll
98 |
99 |
100 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Core.dll
101 |
102 |
103 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll
104 |
105 |
106 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.dll
107 |
108 |
109 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll
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 | {AD2D2DB4-E781-4CF1-9B62-3AAD264F196D}
135 | SegmentedControl.FormsPlugin.Android
136 |
137 |
138 | {CDD2F7A1-0DED-481C-9C4D-4CD0CAE031B5}
139 | SegmentedControl.FormsPlugin.Abstractions
140 |
141 |
142 | {4A1D8886-EB55-4B3E-8F4B-1116463DC387}
143 | Demo
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
--------------------------------------------------------------------------------
/Droid/DemoPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Droid/DemoPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Xamarin.Forms;
4 |
5 | namespace Demo
6 | {
7 | public partial class DemoPage : ContentPage
8 | {
9 | public DemoPage()
10 | {
11 | InitializeComponent();
12 |
13 | Title = "Segmented Control";
14 |
15 | BindingContext = new MainViewModel();
16 |
17 | ToolbarItems.Add(new ToolbarItem
18 | {
19 | Text = "Reset",
20 | Order = ToolbarItemOrder.Primary,
21 | Command = new Command(() => {
22 | SegControl.SelectedSegment = -1;
23 | })
24 | });
25 | }
26 |
27 | void Handle_ValueChanged(object sender, SegmentedControl.FormsPlugin.Abstractions.ValueChangedEventArgs e)
28 | {
29 | switch (e.NewValue)
30 | {
31 | case 0:
32 | SegContent.Children.Clear();
33 | SegContent.Children.Add(new Label() { Text = "Items tab selected" });
34 | break;
35 | case 1:
36 | SegContent.Children.Clear();
37 | SegContent.Children.Add(new Label() { Text = "Notes tab selected" });
38 | break;
39 | case 2:
40 | SegContent.Children.Clear();
41 | SegContent.Children.Add(new Label() { Text = "Approvers tab selected" });
42 | break;
43 | case 3:
44 | SegContent.Children.Clear();
45 | SegContent.Children.Add(new Label() { Text = "Attachments tab selected" });
46 | break;
47 | }
48 | }
49 |
50 | async void Handle_Clicked(object sender, System.EventArgs e)
51 | {
52 | await Navigation.PushAsync(new SecondPage());
53 | }
54 |
55 | protected override void OnAppearing()
56 | {
57 | base.OnAppearing();
58 |
59 | //SegControl.SelectedSegment = 1;
60 |
61 | //SegControl.TintColor = Color.Purple;
62 |
63 | //SegControl.IsEnabled = false;
64 |
65 | //SegControl.SelectedTextColor = Color.Red;
66 | }
67 | }
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/Droid/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Android.App;
4 | using Android.Content;
5 | using Android.Content.PM;
6 | using Android.Runtime;
7 | using Android.Views;
8 | using Android.Widget;
9 | using Android.OS;
10 | using SegmentedControl.FormsPlugin.Android;
11 |
12 | namespace Demo.Droid
13 | {
14 | [Activity(Label = "Demo.Droid", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
15 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
16 | {
17 | protected override void OnCreate(Bundle bundle)
18 | {
19 | TabLayoutResource = Resource.Layout.Tabbar;
20 | ToolbarResource = Resource.Layout.Toolbar;
21 |
22 | base.OnCreate(bundle);
23 |
24 | global::Xamarin.Forms.Forms.Init(this, bundle);
25 |
26 | SegmentedControlRenderer.Init();
27 |
28 | LoadApplication(new App());
29 | }
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/Droid/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Droid/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using Android.App;
4 |
5 | // Information about this assembly is defined by the following attributes.
6 | // Change them to the values specific to your project.
7 |
8 | [assembly: AssemblyTitle("Demo.Droid")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("")]
13 | [assembly: AssemblyCopyright("(c) Alex Reyes")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
18 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
19 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
20 |
21 | [assembly: AssemblyVersion("1.0.0")]
22 |
23 | // The following attributes are used to specify the signing key for the assembly,
24 | // if desired. See the Mono documentation for more information about signing.
25 |
26 | //[assembly: AssemblyDelaySign(false)]
27 | //[assembly: AssemblyKeyFile("")]
28 |
29 |
--------------------------------------------------------------------------------
/Droid/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.axml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable/
12 | icon.png
13 |
14 | layout/
15 | main.axml
16 |
17 | values/
18 | strings.xml
19 |
20 | In order to get the build system to recognize Android resources, set the build action to
21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
22 | instead operate on resource IDs. When you compile an Android application that uses resources,
23 | the build system will package the resources for distribution and generate a class called "R"
24 | (this is an Android convention) that contains the tokens for each one of the resources
25 | included. For example, for the above Resources layout, this is what the R class would expose:
26 |
27 | public class R {
28 | public class drawable {
29 | public const int icon = 0x123;
30 | }
31 |
32 | public class layout {
33 | public const int main = 0x456;
34 | }
35 |
36 | public class strings {
37 | public const int first_string = 0xabc;
38 | public const int second_string = 0xbcd;
39 | }
40 | }
41 |
42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
43 | to reference the layout/main.axml file, or R.strings.first_string to reference the first
44 | string in the dictionary file values/strings.xml.
45 |
--------------------------------------------------------------------------------
/Droid/Resources/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/Droid/Resources/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/Droid/Resources/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/Droid/Resources/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/Droid/Resources/drawable-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/Droid/Resources/drawable-xxhdpi/icon.png
--------------------------------------------------------------------------------
/Droid/Resources/drawable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/Droid/Resources/drawable/icon.png
--------------------------------------------------------------------------------
/Droid/Resources/layout/Tabbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Droid/Resources/layout/Toolbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Droid/Resources/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/Droid/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Segmented Control Plugin for Xamarin Forms
2 |
3 | #### Setup
4 | * Available on NuGet: https://www.nuget.org/packages/SegmentedControl.FormsPlugin/ [](https://www.nuget.org/packages/SegmentedControl.FormsPlugin/)
5 | * Install in your PCL project and Client projects.
6 |
7 | **Platform Support**
8 |
9 | |Platform|Supported|Version|Renderer|
10 | | ------------------- | :-----------: | :-----------: | :------------------: |
11 | |Xamarin.iOS Unified|Yes|iOS 8.1+|UISegmentedControl|
12 | |Xamarin.Android|Yes|API 18+|RadioGroup|
13 |
14 | #### Usage
15 |
16 | In your iOS and Android projects call:
17 |
18 | ```
19 | Xamarin.Forms.Init();
20 | SegmentedControlRenderer.Init();
21 | ```
22 |
23 | #### XAML
24 |
25 | ```xml
26 | xmlns:controls="clr-namespace:SegmentedControl.FormsPlugin.Abstractions;assembly=SegmentedControl.FormsPlugin.Abstractions"
27 | ```
28 |
29 | ```xml
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | ```
41 |
42 | #### Event handler
43 |
44 | ```
45 | public void Handle_ValueChanged(object o, int e)
46 | {
47 | SegContent.Children.Clear();
48 |
49 | switch (e)
50 | {
51 | case 0:
52 | SegContent.Children.Add(new Label() { Text="Tab 1 selected" });
53 | break;
54 | case 1:
55 | SegContent.Children.Add(new Label() { Text = "Tab 2 selected" });
56 | break;
57 | case 2:
58 | SegContent.Children.Add(new Label() { Text = "Tab 3 selected" });
59 | break;
60 | case 3:
61 | SegContent.Children.Add(new Label() { Text = "Tab 4 selected" });
62 | break;
63 | }
64 | }
65 | ```
66 |
67 | **Bindable Properties**
68 |
69 | ```TintColor```: Fill color for the control (Color, default #007AFF)
70 |
71 | ```SelectedTextColor```: Selected segment text color (Color, default #FFFFFF)
72 |
73 | ```SelectedSegment```: Selected segment index (int, default 0).
74 |
75 | **Event Handlers**
76 |
77 | ```ValueChanged```: Called when a segment is selected.
78 |
79 | #### Roadmap
80 |
81 | * Change font family/size
82 |
83 | #### Release Notes
84 |
85 | 2.0.1
86 |
87 | [Android] Segmented Control Not Displaying on Second Page #71
88 |
89 | 2.0.0
90 |
91 | [Update] Adding support for netstandard2.0
92 |
93 | [Update] Adding support for UWP
94 |
95 | [Update] Adding DisabledColor bindable property
96 |
97 | 1.3.4
98 |
99 | [Android] Setting SelectedSegment to -1 to clear selection throws error in Android #61
100 |
101 | [Update] Changing ValueChanged to event to make it available from XAML
102 |
103 | 1.3.3
104 |
105 | [Update] Adding support for no segment selected
106 |
107 | [Update] Preventing crashes OnElementPropertyChanged because Element or NativeControl are null.
108 |
109 | 1.3.2
110 |
111 | [Android] Segmented Control Not Displaying on Second Page #51
112 |
113 | [Android] About 150 warnings about resources #50
114 |
115 | [Android] Android package incompatible with latest Xamarin Forms #48
116 |
117 | [Android] Segmented Control Not rendering in Android #46
118 |
119 | [Android] Late instantiation of the RadioGroup control in the Android renderer fails to display bug #45
120 |
121 | [Android] Object Disposed Exception. Crash. Android only #44
122 |
123 | [Android] Segmented control changed displaying inside Grid #42
124 |
125 | [Update] Doesn't work with Xamarin.Forms Previewer #49
126 |
127 | 1.3.1
128 |
129 | [Android] Regression: control is not displayed anymore on Android #36 fixed.
130 |
131 | 1.3.0
132 |
133 | [Update] SelectedText property deprecated.
134 |
135 | [Update] SelectTab method deprecated (changed SelectedSegment property instead).
136 |
137 | [Update] ChangeTintColor method deprecated (change TintColor property instead).
138 |
139 | [iOS] SelectedTextColor property implemented.
140 |
141 | [Android] Strange colors with disabled android control #16 (fixed).
142 |
143 | [Android] Blue color on first and third control #19 (fixed).
144 |
145 | [Android] SegmentedControlOption are getting duplicated on android rotation #23 (fixed).
146 |
147 | [Android] TintColor not getting set #26 (fixed).
148 |
149 | [Android] Segment Text Misaligns when page is left, returned to #30 (fixed).
150 |
151 | 1.2.4
152 |
153 | [Android] #14 IsEnabled has no effect on Android (fixed)
154 |
155 | 1.2.3
156 |
157 | [Android] #14 IsEnabled has no effect on Android (fixed)
158 |
159 | 1.2.2
160 |
161 | [Android] Adding SelectedTextColor property to match iOS control behavior
162 |
163 | [Android] Fixing bug #11 Invalid cast exception. Android platform
164 |
165 | 1.2.1
166 |
167 | [Android] Matching tint color behavior with iOS control
168 |
169 | #### Contributors
170 | * [alexrainman](https://github.com/alexrainman)
171 |
172 | Thanks!
173 |
174 | #### License
175 | Licensed under MIT
176 |
--------------------------------------------------------------------------------
/SegmentedControl.userprefs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Abstractions.Portable/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("SegmentedControl.FormsPlugin.Abstractions.Portable")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("")]
12 | [assembly: AssemblyCopyright("${AuthorCopyright}")]
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 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Abstractions.Portable/SegmentedControl.FormsPlugin.Abstractions.Portable.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {FE5D782A-5BF2-4C99-BF8F-D72188D37334}
7 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
8 | true
9 | Library
10 | SegmentedControl.FormsPlugin.Abstractions
11 | SegmentedControl.FormsPlugin.Abstractions
12 | v4.5
13 | Profile111
14 | 1.2.4
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug
21 | DEBUG;
22 | prompt
23 | 4
24 |
25 |
26 | true
27 | bin\Release
28 | prompt
29 | 4
30 |
31 |
32 |
33 |
34 | SegmentedControl.cs
35 |
36 |
37 |
38 |
39 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\portable-win+net45+wp80+win81+wpa81\Xamarin.Forms.Core.dll
40 |
41 |
42 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\portable-win+net45+wp80+win81+wpa81\Xamarin.Forms.Platform.dll
43 |
44 |
45 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\portable-win+net45+wp80+win81+wpa81\Xamarin.Forms.Xaml.dll
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Abstractions.Portable/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Abstractions/SegmentedControl.FormsPlugin.Abstractions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | 1.2.4
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Abstractions/SegmentedControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using Xamarin.Forms;
5 |
6 | namespace SegmentedControl.FormsPlugin.Abstractions
7 | {
8 | ///
9 | /// SegmentedControl Interface
10 | ///
11 | public class SegmentedControl : View, IViewContainer
12 | {
13 | public IList Children { get; set; }
14 |
15 | public SegmentedControl()
16 | {
17 | Children = new List();
18 | }
19 |
20 | public static readonly BindableProperty TintColorProperty = BindableProperty.Create("TintColor", typeof(Color), typeof(SegmentedControl), Color.Blue);
21 |
22 | public Color TintColor
23 | {
24 | get { return (Color)GetValue(TintColorProperty); }
25 | set { SetValue(TintColorProperty, value); }
26 | }
27 |
28 | public static readonly BindableProperty DisabledColorProperty = BindableProperty.Create("DisabledColor", typeof(Color), typeof(SegmentedControl), Color.Gray);
29 |
30 | public Color DisabledColor
31 | {
32 | get { return (Color)GetValue(DisabledColorProperty); }
33 | set { SetValue(DisabledColorProperty, value); }
34 | }
35 |
36 | public static readonly BindableProperty SelectedTextColorProperty = BindableProperty.Create("SelectedTextColor", typeof(Color), typeof(SegmentedControl), Color.White);
37 |
38 | public Color SelectedTextColor
39 | {
40 | get { return (Color)GetValue(SelectedTextColorProperty); }
41 | set { SetValue(SelectedTextColorProperty, value); }
42 | }
43 |
44 | public static readonly BindableProperty SelectedSegmentProperty = BindableProperty.Create("SelectedSegment", typeof(int), typeof(SegmentedControl), 0);
45 |
46 | public int SelectedSegment
47 | {
48 | get {
49 | return (int)GetValue(SelectedSegmentProperty);
50 | }
51 | set {
52 | SetValue(SelectedSegmentProperty, value);
53 | }
54 | }
55 |
56 | public event EventHandler ValueChanged;
57 |
58 | [EditorBrowsable(EditorBrowsableState.Never)]
59 | public void SendValueChanged()
60 | {
61 | ValueChanged?.Invoke(this, new ValueChangedEventArgs { NewValue = this.SelectedSegment });
62 | }
63 | }
64 |
65 | public class SegmentedControlOption : View
66 | {
67 | public static readonly BindableProperty TextProperty = BindableProperty.Create("Text", typeof(string), typeof(SegmentedControlOption), string.Empty);
68 |
69 | public string Text
70 | {
71 | get { return (string)GetValue(TextProperty); }
72 | set { SetValue(TextProperty, value); }
73 | }
74 | }
75 |
76 | public class ValueChangedEventArgs : EventArgs
77 | {
78 | public int NewValue { get; set; }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.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("SegmentedControl.FormsPlugin.Android")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("SegmentedControl.FormsPlugin.Android")]
14 | [assembly: AssemblyCopyright("Copyright © 2016")]
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 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.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.
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/Resources/color/segmented_control_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/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 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/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 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/Resources/drawable/segmented_control_last_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 | -
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/Resources/layout/RadioButton.axml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/Resources/layout/RadioGroup.axml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/Resources/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | @android:color/transparent
4 | #007AFF
5 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/SegmentedControl.FormsPlugin.Android.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | 8.0.30703
8 | 2.0
9 | {AD2D2DB4-E781-4CF1-9B62-3AAD264F196D}
10 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
11 | Library
12 | Properties
13 | SegmentedControl.FormsPlugin.Android
14 | SegmentedControl.FormsPlugin.Android
15 | 512
16 | Resources\Resource.Designer.cs
17 | Off
18 | True
19 | True
20 |
21 |
22 | v8.0
23 | 1.2.4
24 |
25 |
26 | true
27 | full
28 | false
29 | bin\Debug\
30 | DEBUG;TRACE
31 | prompt
32 | 4
33 |
34 |
35 | pdbonly
36 | true
37 | bin\Release\
38 | TRACE
39 | prompt
40 | 4
41 | bin\Release\SegmentedControl.FormsPlugin.Android.XML
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | ..\..\packages\Xamarin.Android.Support.Annotations.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Annotations.dll
52 |
53 |
54 | ..\..\packages\Xamarin.Android.Support.Compat.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Compat.dll
55 |
56 |
57 | ..\..\packages\Xamarin.Android.Support.Core.UI.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Core.UI.dll
58 |
59 |
60 | ..\..\packages\Xamarin.Android.Support.Core.Utils.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Core.Utils.dll
61 |
62 |
63 | ..\..\packages\Xamarin.Android.Support.Media.Compat.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Media.Compat.dll
64 |
65 |
66 | ..\..\packages\Xamarin.Android.Support.Fragment.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Fragment.dll
67 |
68 |
69 | ..\..\packages\Xamarin.Android.Support.Transition.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Transition.dll
70 |
71 |
72 | ..\..\packages\Xamarin.Android.Support.v4.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v4.dll
73 |
74 |
75 | ..\..\packages\Xamarin.Android.Support.v7.CardView.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.CardView.dll
76 |
77 |
78 | ..\..\packages\Xamarin.Android.Support.v7.Palette.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.Palette.dll
79 |
80 |
81 | ..\..\packages\Xamarin.Android.Support.v7.RecyclerView.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.RecyclerView.dll
82 |
83 |
84 | ..\..\packages\Xamarin.Android.Support.Vector.Drawable.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.dll
85 |
86 |
87 | ..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.dll
88 |
89 |
90 | ..\..\packages\Xamarin.Android.Support.v7.AppCompat.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.dll
91 |
92 |
93 | ..\..\packages\Xamarin.Android.Support.Design.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.Design.dll
94 |
95 |
96 | ..\..\packages\Xamarin.Android.Support.v7.MediaRouter.25.4.0.2\lib\MonoAndroid70\Xamarin.Android.Support.v7.MediaRouter.dll
97 |
98 |
99 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\FormsViewGroup.dll
100 |
101 |
102 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Core.dll
103 |
104 |
105 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll
106 |
107 |
108 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.dll
109 |
110 |
111 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | {CDD2F7A1-0DED-481C-9C4D-4CD0CAE031B5}
135 | SegmentedControl.FormsPlugin.Abstractions
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/SegmentedControlImplementation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xamarin.Forms;
3 | using SegmentedControl.FormsPlugin.Android;
4 | using Xamarin.Forms.Platform.Android;
5 | using Android.Widget;
6 | using Android.Views;
7 | using Android.Graphics.Drawables;
8 | using Android.Content;
9 |
10 | [assembly: ExportRenderer(typeof(SegmentedControl.FormsPlugin.Abstractions.SegmentedControl), typeof(SegmentedControlRenderer))]
11 | namespace SegmentedControl.FormsPlugin.Android
12 | {
13 | ///
14 | /// SegmentedControl Renderer
15 | ///
16 | public class SegmentedControlRenderer : ViewRenderer
17 | {
18 | RadioGroup nativeControl;
19 | RadioButton _rb;
20 | Context context;
21 |
22 | public SegmentedControlRenderer(Context context) : base(context)
23 | {
24 | this.context = context;
25 | }
26 |
27 | protected override void OnElementChanged(ElementChangedEventArgs e)
28 | {
29 | base.OnElementChanged(e);
30 |
31 | if (Control == null)
32 | {
33 | // Instantiate the native control and assign it to the Control property with
34 | // the SetNativeControl method
35 |
36 | var layoutInflater = LayoutInflater.From(context);
37 |
38 | var view = layoutInflater.Inflate(Resource.Layout.RadioGroup, null);
39 |
40 | nativeControl = (RadioGroup)layoutInflater.Inflate(Resource.Layout.RadioGroup, null);
41 |
42 | for (var i = 0; i < Element.Children.Count; i++)
43 | {
44 | var o = Element.Children[i];
45 | var rb = (RadioButton)layoutInflater.Inflate(Resource.Layout.RadioButton, null);
46 |
47 | rb.LayoutParameters = new RadioGroup.LayoutParams(0, LayoutParams.WrapContent, 1f);
48 | rb.Text = o.Text;
49 |
50 | if (i == 0)
51 | rb.SetBackgroundResource(Resource.Drawable.segmented_control_first_background);
52 | else if (i == Element.Children.Count - 1)
53 | rb.SetBackgroundResource(Resource.Drawable.segmented_control_last_background);
54 |
55 | ConfigureRadioButton(i, rb);
56 |
57 | nativeControl.AddView(rb);
58 | }
59 |
60 | var option = (RadioButton)nativeControl.GetChildAt(Element.SelectedSegment);
61 |
62 | if (option != null)
63 | option.Checked = true;
64 |
65 | SetNativeControl(nativeControl);
66 | }
67 |
68 | if (e.OldElement != null)
69 | {
70 | // Unsubscribe from event handlers and cleanup any resources
71 |
72 | if (nativeControl != null)
73 | nativeControl.CheckedChange -= NativeControl_ValueChanged;
74 | }
75 |
76 | if (e.NewElement != null)
77 | {
78 | // Configure the control and subscribe to event handlers
79 |
80 | nativeControl.CheckedChange += NativeControl_ValueChanged;
81 | }
82 | }
83 |
84 | protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
85 | {
86 | base.OnElementPropertyChanged(sender, e);
87 |
88 | if (nativeControl == null || Element == null) return;
89 |
90 | switch (e.PropertyName)
91 | {
92 | case "Renderer":
93 | Element?.SendValueChanged();
94 | break;
95 | case "SelectedSegment":
96 | var option = (RadioButton)nativeControl.GetChildAt(Element.SelectedSegment);
97 |
98 | if (option != null)
99 | option.Checked = true;
100 |
101 | if (Element.SelectedSegment < 0)
102 | {
103 | var layoutInflater = LayoutInflater.From(context);
104 |
105 | nativeControl = (RadioGroup)layoutInflater.Inflate(Resource.Layout.RadioGroup, null);
106 |
107 | for (var i = 0; i < Element.Children.Count; i++)
108 | {
109 | var o = Element.Children[i];
110 | var rb = (RadioButton)layoutInflater.Inflate(Resource.Layout.RadioButton, null);
111 |
112 | rb.LayoutParameters = new RadioGroup.LayoutParams(0, LayoutParams.WrapContent, 1f);
113 | rb.Text = o.Text;
114 |
115 | if (i == 0)
116 | rb.SetBackgroundResource(Resource.Drawable.segmented_control_first_background);
117 | else if (i == Element.Children.Count - 1)
118 | rb.SetBackgroundResource(Resource.Drawable.segmented_control_last_background);
119 |
120 | ConfigureRadioButton(i, rb);
121 |
122 | nativeControl.AddView(rb);
123 | }
124 |
125 | nativeControl.CheckedChange += NativeControl_ValueChanged;
126 |
127 | SetNativeControl(nativeControl);
128 | }
129 |
130 | Element.SendValueChanged();
131 | break;
132 | case "TintColor":
133 | OnPropertyChanged();
134 | break;
135 | case "IsEnabled":
136 | OnPropertyChanged();
137 | break;
138 | case "SelectedTextColor":
139 | var v = (RadioButton)nativeControl.GetChildAt(Element.SelectedSegment);
140 | v.SetTextColor(Element.SelectedTextColor.ToAndroid());
141 | break;
142 | }
143 | }
144 |
145 | void OnPropertyChanged()
146 | {
147 | if (nativeControl != null && Element != null)
148 | {
149 | for (var i = 0; i < Element.Children.Count; i++)
150 | {
151 | var rb = (RadioButton)nativeControl.GetChildAt(i);
152 |
153 | ConfigureRadioButton(i, rb);
154 | }
155 | }
156 | }
157 |
158 | void ConfigureRadioButton(int i, RadioButton rb)
159 | {
160 | if (i == Element.SelectedSegment)
161 | {
162 | rb.SetTextColor(Element.SelectedTextColor.ToAndroid());
163 | _rb = rb;
164 | }
165 | else
166 | {
167 | var textColor = Element.IsEnabled ? Element.TintColor.ToAndroid() : Element.DisabledColor.ToAndroid();
168 | rb.SetTextColor(textColor);
169 | }
170 |
171 | GradientDrawable selectedShape;
172 | GradientDrawable unselectedShape;
173 |
174 | var gradientDrawable = (StateListDrawable)rb.Background;
175 | var drawableContainerState = (DrawableContainer.DrawableContainerState)gradientDrawable.GetConstantState();
176 | var children = drawableContainerState.GetChildren();
177 |
178 | // Doesnt works on API < 18
179 | selectedShape = children[0] is GradientDrawable? (GradientDrawable)children[0] : (GradientDrawable)((InsetDrawable)children[0]).Drawable;
180 | unselectedShape = children[1] is GradientDrawable? (GradientDrawable)children[1] : (GradientDrawable)((InsetDrawable)children[1]).Drawable;
181 |
182 | var color = Element.IsEnabled ? Element.TintColor.ToAndroid() : Element.DisabledColor.ToAndroid();
183 |
184 | selectedShape.SetStroke(3, color);
185 | selectedShape.SetColor(color);
186 | unselectedShape.SetStroke(3, color);
187 |
188 | rb.Enabled = Element.IsEnabled;
189 | }
190 |
191 | void NativeControl_ValueChanged(object sender, RadioGroup.CheckedChangeEventArgs e)
192 | {
193 | var rg = (RadioGroup)sender;
194 | if (rg.CheckedRadioButtonId != -1)
195 | {
196 | var id = rg.CheckedRadioButtonId;
197 | var radioButton = rg.FindViewById(id);
198 | var radioId = rg.IndexOfChild(radioButton);
199 |
200 | var rb = (RadioButton)rg.GetChildAt(radioId);
201 |
202 | var color = Element.IsEnabled ? Element.TintColor.ToAndroid() : Element.DisabledColor.ToAndroid();
203 | _rb?.SetTextColor(color);
204 | rb.SetTextColor(Element.SelectedTextColor.ToAndroid());
205 | _rb = rb;
206 |
207 | Element.SelectedSegment = radioId;
208 | }
209 | }
210 |
211 | protected override void Dispose(bool disposing)
212 | {
213 | if (nativeControl != null)
214 | {
215 | nativeControl.CheckedChange -= NativeControl_ValueChanged;
216 | nativeControl.Dispose();
217 | nativeControl = null;
218 | _rb = null;
219 | }
220 |
221 | try
222 | {
223 | base.Dispose(disposing);
224 | }
225 | catch (Exception ex)
226 | {
227 | return;
228 | }
229 | }
230 | ///
231 | /// Used for registration with dependency service
232 | ///
233 | public static void Init() {
234 | var temp = DateTime.Now;
235 | }
236 | }
237 | }
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/SegmentedControl.FormsPlugin.Abstractions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SegmentedControl.FormsPlugin.Abstractions
5 |
6 |
7 |
8 |
9 | SegmentedControl Interface
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/MonoAndroid,Version=v7.0.AssemblyAttribute.cs:
--------------------------------------------------------------------------------
1 | //
2 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute("MonoAndroid,Version=v7.0", FrameworkDisplayName = "")]
3 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/SegmentedControl.FormsPlugin.Android.csproj.FilesWrittenAbsolute.txt:
--------------------------------------------------------------------------------
1 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/MonoAndroid,Version=v7.0.AssemblyAttribute.cs
2 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/SegmentedControl.FormsPlugin.Android.obj.Release.__AndroidLibraryProjects__.zip
3 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/SegmentedControl.FormsPlugin.Android.dll.mdb
4 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/SegmentedControl.FormsPlugin.Android.dll
5 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/SegmentedControl.FormsPlugin.Android.apk
6 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/android/bin/SegmentedControl.FormsPlugin.Android.apk
7 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/res/color/segmented_control_text.xml
8 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/res/drawable/segmented_control_background.xml
9 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/res/drawable/segmented_control_first_background.xml
10 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/res/drawable/segmented_control_last_background.xml
11 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/res/layout/radiobutton.xml
12 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/res/layout/radiogroup.xml
13 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/res/values/colors.xml
14 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/R.cs.flag
15 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/SegmentedControl.FormsPlugin.Android-Signed.apk
16 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/uploadflags.txt
17 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/SegmentedControl.FormsPlugin.Android.dll
18 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/SegmentedControl.FormsPlugin.Android.dll.mdb
19 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Android.Support.v4.dll
20 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Android.Support.Vector.Drawable.dll
21 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Android.Support.Animated.Vector.Drawable.dll
22 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Android.Support.v7.AppCompat.dll
23 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Android.Support.v7.RecyclerView.dll
24 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Android.Support.Design.dll
25 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Android.Support.v7.CardView.dll
26 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Android.Support.v7.MediaRouter.dll
27 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/FormsViewGroup.dll
28 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Forms.Core.dll
29 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Forms.Platform.Android.dll
30 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Forms.Platform.dll
31 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/Xamarin.Forms.Xaml.dll
32 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/SegmentedControl.FormsPlugin.Abstractions.dll
33 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/SegmentedControl.FormsPlugin.Abstractions.dll.mdb
34 | /Users/alexrainman/Git/SegmentedControl/SegmentedControl/SegmentedControl.FormsPlugin.Android/bin/Release/SegmentedControl.FormsPlugin.Abstractions.xml
35 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/SegmentedControl.FormsPlugin.Android.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/SegmentedControl.FormsPlugin.Android.dll.mdb
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/SegmentedControl.FormsPlugin.Android.obj.Release.__AndroidLibraryProjects__.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/SegmentedControl.FormsPlugin.Android.obj.Release.__AndroidLibraryProjects__.zip
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/library_project_imports/__res_name_case_map.txt:
--------------------------------------------------------------------------------
1 | color/segmented_control_text.xml;color/segmented_control_text.xml
2 | drawable/segmented_control_background.xml;drawable/segmented_control_background.xml
3 | drawable/segmented_control_first_background.xml;drawable/segmented_control_first_background.xml
4 | drawable/segmented_control_last_background.xml;drawable/segmented_control_last_background.xml
5 | layout/RadioButton.axml;layout/radiobutton.xml
6 | layout/RadioGroup.axml;layout/radiogroup.xml
7 | values/colors.xml;values/colors.xml
8 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/library_project_imports/res/color/segmented_control_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/library_project_imports/res/drawable/segmented_control_background.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/library_project_imports/res/drawable/segmented_control_first_background.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/library_project_imports/res/drawable/segmented_control_last_background.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/library_project_imports/res/layout/radiobutton.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/library_project_imports/res/layout/radiogroup.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/library_project_imports/res/values/colors.xml:
--------------------------------------------------------------------------------
1 | @android:color/transparent#007AFF
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/obj/Release/sdks.cache:
--------------------------------------------------------------------------------
1 |
2 |
3 | 24
4 | 24
5 | /Users/alexrainman/Library/Developer/Xamarin/android-ndk/android-ndk-r11c
6 | /Users/alexrainman/Library/Developer/Xamarin/android-sdk-macosx/build-tools/24.0.3
7 | /Users/alexrainman/Library/Developer/Xamarin/android-sdk-macosx/build-tools/24.0.3
8 | /Users/alexrainman/Library/Developer/Xamarin/android-sdk-macosx
9 | /usr
10 | /Library/Frameworks/Xamarin.Android.framework/Versions/Current/bin
11 | /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid
12 |
13 | /Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/
14 |
15 | v7.0
16 | /Users/alexrainman/Library/Developer/Xamarin/android-sdk-macosx/build-tools/24.0.3
17 |
18 | 24
19 | None
20 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.Android/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.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("SegmentedControl.FormsPlugin.UWP")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SegmentedControl.FormsPlugin.UWP")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
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)]
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/Properties/SegmentedControl.FormsPlugin.UWP.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/SegmentRadioButton.cs:
--------------------------------------------------------------------------------
1 | using Windows.UI.Xaml;
2 | using Windows.UI.Xaml.Controls;
3 | using Windows.UI.Xaml.Media;
4 |
5 | /*
6 | * https://github.com/1iveowl/Plugin.SegmentedControl
7 | */
8 |
9 | namespace SegmentedControl.FormsPlugin.UWP
10 | {
11 | public class SegmentRadioButton : RadioButton
12 | {
13 | public static readonly DependencyProperty SelectedTextColorProperty = DependencyProperty.Register(
14 | "SelectedTextColor",
15 | typeof(SolidColorBrush), typeof(SegmentRadioButton),
16 | new PropertyMetadata(default(SolidColorBrush), new PropertyChangedCallback(OnSelectedTextChanged)));
17 |
18 | public SolidColorBrush SelectedTextColor
19 | {
20 | get => (SolidColorBrush) GetValue(SelectedTextColorProperty);
21 | set => SetValue(SelectedTextColorProperty, value);
22 | }
23 |
24 | public static readonly DependencyProperty TintColorProperty = DependencyProperty.Register(
25 | "TintColor", typeof(SolidColorBrush), typeof(SegmentRadioButton), new PropertyMetadata(default(SolidColorBrush), new PropertyChangedCallback(OnTintChanged)));
26 |
27 | public SolidColorBrush TintColor
28 | {
29 | get => (SolidColorBrush) GetValue(TintColorProperty);
30 | set => SetValue(TintColorProperty, value);
31 | }
32 |
33 | public static readonly DependencyProperty DisabledColorProperty = DependencyProperty.Register(
34 | "DisabledColor", typeof(SolidColorBrush), typeof(SegmentRadioButton), new PropertyMetadata(default(SolidColorBrush), new PropertyChangedCallback(OnDisabledColorChanged)));
35 |
36 | public SolidColorBrush DisabledColor
37 | {
38 | get => (SolidColorBrush) GetValue(DisabledColorProperty);
39 | set => SetValue(DisabledColorProperty, value);
40 | }
41 |
42 | private static void OnSelectedTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
43 | {
44 | if (d is SegmentRadioButton segment)
45 | {
46 | Refresh(segment);
47 | }
48 | }
49 |
50 | private static void OnTintChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
51 | {
52 | if (d is SegmentRadioButton segment)
53 | {
54 | segment.BorderBrush = (SolidColorBrush) e.NewValue;
55 | Refresh(segment);
56 | }
57 | }
58 |
59 |
60 | private static void OnDisabledColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
61 | {
62 | if (d is SegmentRadioButton segment)
63 | {
64 | segment.BorderBrush = (SolidColorBrush)e.NewValue;
65 | Refresh(segment);
66 | }
67 | }
68 |
69 | public SegmentRadioButton()
70 | {
71 | this.IsEnabledChanged += SegmentRadioButton_IsEnabledChanged;
72 | }
73 |
74 | private void SegmentRadioButton_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
75 | {
76 | if (sender is SegmentRadioButton segment)
77 | {
78 | Refresh(segment);
79 | }
80 | }
81 |
82 | public static void Refresh(SegmentRadioButton segment)
83 | {
84 | // Go to "Indeterminate" State to ensure that the GotoState is refreshed even if the state is the same.
85 | // Necessary because properties might have changed even when the state have not.
86 |
87 | VisualStateManager.GoToState(segment, "Indeterminate", false);
88 |
89 | if (segment.IsChecked ?? false)
90 | {
91 | VisualStateManager.GoToState(segment, segment.IsEnabled ? "Checked" : "DisabledAndChecked", false);
92 | }
93 | else
94 | {
95 | VisualStateManager.GoToState(segment, segment.IsEnabled ? "Unchecked" : "DisabledAndUnchecked", false);
96 | }
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/SegmentedControl.FormsPlugin.UWP.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {9DD9F8E8-4A69-47AF-A7EF-73CA9C3F80EA}
8 | Library
9 | Properties
10 | SegmentedControl.FormsPlugin.UWP
11 | SegmentedControl.FormsPlugin.UWP
12 | en-US
13 | UAP
14 | 10.0.16299.0
15 | 10.0.16299.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | 1.2.4
20 |
21 |
22 | AnyCPU
23 | true
24 | full
25 | false
26 | bin\Debug\
27 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
28 | prompt
29 | 4
30 |
31 |
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 |
108 |
109 |
110 |
111 |
112 |
113 |
114 | SegmentedUserControl.xaml
115 |
116 |
117 |
118 |
119 |
120 |
121 | {14c534b6-1984-41a9-a384-d3a5508588e3}
122 | SegmentedControl.FormsPlugin.Abstractions
123 |
124 |
125 |
126 |
127 | MSBuild:Compile
128 | Designer
129 |
130 |
131 | MSBuild:Compile
132 | Designer
133 |
134 |
135 |
136 | 14.0
137 |
138 |
139 |
146 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/SegmentedControl.FormsPlugin.UWP.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ProjectFiles
5 |
6 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/SegmentedControl.FormsPlugin.UWP.nuget.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/SegmentedControlImplementation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xamarin.Forms;
3 | using SegmentedControl.FormsPlugin.UWP;
4 | using Xamarin.Forms.Platform.UWP;
5 | using System.ComponentModel;
6 | using Windows.UI.Xaml.Media;
7 | using Windows.UI.Xaml;
8 | using System.Linq;
9 |
10 | /*
11 | * https://github.com/1iveowl/Plugin.SegmentedControl
12 | */
13 |
14 | [assembly: ExportRenderer(typeof(SegmentedControl.FormsPlugin.Abstractions.SegmentedControl), typeof(SegmentedControlRenderer))]
15 | namespace SegmentedControl.FormsPlugin.UWP
16 | {
17 | ///
18 | /// SegmentedControl Renderer
19 | ///
20 | public class SegmentedControlRenderer : ViewRenderer
21 | {
22 | private SegmentedUserControl nativeControl;
23 |
24 | private readonly ColorConverter _colorConverter = new ColorConverter();
25 |
26 | protected override void OnElementChanged(ElementChangedEventArgs e)
27 | {
28 | base.OnElementChanged(e);
29 |
30 | if (Control == null)
31 | {
32 | nativeControl = new SegmentedUserControl();
33 |
34 | var radioButtonGroupName = Guid.NewGuid().ToString();
35 |
36 | var grid = nativeControl.SegmentedControlGrid;
37 | grid.BorderBrush = (SolidColorBrush)_colorConverter.Convert(Element.TintColor, null, null, "");
38 |
39 | grid.ColumnDefinitions.Clear();
40 | grid.Children.Clear();
41 |
42 | for (var i = 0; i < Element.Children.Count; i++)
43 | {
44 | var segmentButton = new SegmentRadioButton
45 | {
46 | GroupName = radioButtonGroupName,
47 | Style = (Windows.UI.Xaml.Style)nativeControl.Resources["SegmentedRadioButtonStyle"],
48 | Content = Element.Children[i].Text,
49 | Tag = i,
50 | HorizontalAlignment = HorizontalAlignment.Stretch,
51 | VerticalAlignment = VerticalAlignment.Stretch,
52 | BorderBrush = (SolidColorBrush)_colorConverter.Convert(Element.TintColor, null, null, ""),
53 | SelectedTextColor = (SolidColorBrush)_colorConverter.Convert(Element.SelectedTextColor, null, null, ""),
54 | TintColor = (SolidColorBrush)_colorConverter.Convert(Element.TintColor, null, null, ""),
55 | DisabledColor = (SolidColorBrush)_colorConverter.Convert(Element.DisabledColor, null, null, ""),
56 | BorderThickness = i > 0 ? new Windows.UI.Xaml.Thickness(1, 0, 0, 0) : new Windows.UI.Xaml.Thickness(0, 0, 0, 0),
57 | IsEnabled = Element.IsEnabled
58 | };
59 |
60 | segmentButton.Checked += SegmentRadioButtonOnChecked;
61 |
62 | if (i == Element.SelectedSegment)
63 | {
64 | segmentButton.IsChecked = true;
65 | }
66 |
67 | grid.ColumnDefinitions.Add(new Windows.UI.Xaml.Controls.ColumnDefinition
68 | {
69 | Width = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Star),
70 | });
71 |
72 | grid.Children.Add(segmentButton);
73 |
74 | Windows.UI.Xaml.Controls.Grid.SetColumn(segmentButton, i);
75 | }
76 |
77 | SetNativeControl(nativeControl);
78 | }
79 |
80 | if (e.OldElement != null)
81 | {
82 | DisposeEventHandlers();
83 | }
84 |
85 | if (e.NewElement != null)
86 | {
87 |
88 | }
89 | }
90 |
91 | protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
92 | {
93 | base.OnElementPropertyChanged(sender, e);
94 |
95 | if (nativeControl == null || Element == null) return;
96 |
97 | switch (e.PropertyName)
98 | {
99 | case "Renderer":
100 | Element?.SendValueChanged();
101 | break;
102 | case "SelectedSegment":
103 | if (Element.SelectedSegment == -1)
104 | {
105 | // find checked segment and unselect it
106 | var segment = (Windows.UI.Xaml.Controls.RadioButton)nativeControl.SegmentedControlGrid.Children
107 | .Where(x =>
108 | {
109 | var btn = (Windows.UI.Xaml.Controls.RadioButton)x;
110 | return btn.IsChecked == true;
111 | })
112 | .FirstOrDefault();
113 | segment.IsChecked = false;
114 | return;
115 | }
116 | if (nativeControl.SegmentedControlGrid.Children
117 | .Where(x =>
118 | {
119 | var btn = (Windows.UI.Xaml.Controls.RadioButton)x;
120 |
121 | int.TryParse(btn.Tag.ToString(), out var i);
122 | return i == Element.SelectedSegment;
123 | })
124 | .FirstOrDefault() is Windows.UI.Xaml.Controls.RadioButton checkedButton)
125 | {
126 | checkedButton.IsChecked = true;
127 | }
128 | Element?.SendValueChanged();
129 | break;
130 | case "TintColor":
131 | foreach (var segment in nativeControl.SegmentedControlGrid.Children)
132 | {
133 | ((SegmentRadioButton)segment).TintColor = (SolidColorBrush)_colorConverter.Convert(Element.TintColor, null, null, "");
134 | }
135 | break;
136 | case "DisabledColor":
137 | foreach (var segment in nativeControl.SegmentedControlGrid.Children)
138 | {
139 | ((SegmentRadioButton)segment).DisabledColor = (SolidColorBrush)_colorConverter.Convert(Element.DisabledColor, null, null, "");
140 | }
141 | break;
142 | case "Height":
143 | // Hack to fix IsEnabled at First Launch
144 | foreach (var uiElement in nativeControl.SegmentedControlGrid.Children)
145 | {
146 | var segment = (SegmentRadioButton)uiElement;
147 | SegmentRadioButton.Refresh(segment);
148 | }
149 | nativeControl.SegmentedControlGrid.BorderBrush = Element.IsEnabled ? (SolidColorBrush)_colorConverter.Convert(Element.TintColor, null, null, "") : (SolidColorBrush)_colorConverter.Convert(Element.DisabledColor, null, null, "");
150 | break;
151 | case "IsEnabled":
152 | foreach (var uiElement in nativeControl.SegmentedControlGrid.Children)
153 | {
154 | var segment = (SegmentRadioButton)uiElement;
155 | segment.IsEnabled = Element.IsEnabled;
156 | }
157 | nativeControl.SegmentedControlGrid.BorderBrush = Element.IsEnabled ? (SolidColorBrush)_colorConverter.Convert(Element.TintColor, null, null, "") : (SolidColorBrush)_colorConverter.Convert(Element.DisabledColor, null, null, "");
158 | break;
159 | case "SelectedTextColor":
160 | SetSelectedTextColor();
161 | break;
162 | }
163 | }
164 |
165 | private void SetSelectedTextColor()
166 | {
167 | foreach (var segment in nativeControl.SegmentedControlGrid.Children)
168 | {
169 | ((SegmentRadioButton)segment).SelectedTextColor = (SolidColorBrush)_colorConverter.Convert(Element.SelectedTextColor, null, null, "");
170 | }
171 | }
172 |
173 | private void SegmentRadioButtonOnChecked(object sender, RoutedEventArgs e)
174 | {
175 | var button = (SegmentRadioButton)sender;
176 |
177 | if (button != null)
178 | {
179 | Element.SelectedSegment = int.Parse(button.Tag.ToString());
180 | Element?.SendValueChanged();
181 | }
182 | }
183 |
184 | protected override void Dispose(bool disposing)
185 | {
186 | DisposeEventHandlers();
187 |
188 | base.Dispose(disposing);
189 | }
190 |
191 | private void DisposeEventHandlers()
192 | {
193 | if (nativeControl != null)
194 | {
195 | foreach (var segment in nativeControl.SegmentedControlGrid.Children)
196 | {
197 | ((SegmentRadioButton)segment).Checked -= SegmentRadioButtonOnChecked;
198 | }
199 | }
200 | }
201 | }
202 | }
203 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/SegmentedRadioButtonStyle.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/SegmentedUserControl.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/SegmentedUserControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using Windows.UI.Xaml.Controls;
2 |
3 | /*
4 | * https://github.com/1iveowl/Plugin.SegmentedControl
5 | */
6 |
7 | // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
8 |
9 | namespace SegmentedControl.FormsPlugin.UWP
10 | {
11 | public sealed partial class SegmentedUserControl : UserControl
12 | {
13 | public Grid SegmentedControlGrid => mainGrid;
14 | public SegmentedUserControl()
15 | {
16 | this.InitializeComponent();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/SegmentedControl/SegmentedControl.FormsPlugin.UWP/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/SegmentedControl/SegmentedControl.FormsPlugin.UWP/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/SegmentedControl/SegmentedControl.FormsPlugin.UWP/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/SegmentedControl/SegmentedControl.FormsPlugin.UWP/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.UWP/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.NETCore.UniversalWindowsPlatform": "6.0.1",
4 | "Xamarin.Forms": "2.5.0.121934"
5 | },
6 | "frameworks": {
7 | "uap10.0.16299": {}
8 | },
9 | "runtimes": {
10 | "win10-arm": {},
11 | "win10-arm-aot": {},
12 | "win10-x86": {},
13 | "win10-x86-aot": {},
14 | "win10-x64": {},
15 | "win10-x64-aot": {}
16 | }
17 | }
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.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("SegmentedControl.FormsPlugin.iOS")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SegmentedControl.FormsPlugin.iOS")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
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("a41090b7-b41d-469a-99d0-c35666b573d0")]
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 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.iOS/SegmentedControl.FormsPlugin.iOS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | 8.0.30703
8 | 2.0
9 | {D525F236-6A2D-4010-B1CC-4A4B8581C90B}
10 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
11 | Library
12 | SegmentedControl.FormsPlugin.iOS
13 | Resources
14 | SegmentedControl.FormsPlugin.iOS
15 |
16 |
17 | 1.2.4
18 |
19 |
20 | true
21 | full
22 | false
23 | bin\iPhone\Debug
24 | DEBUG
25 | prompt
26 | 4
27 | false
28 | true
29 | iPhone Developer
30 |
31 |
32 | none
33 | true
34 | bin\iPhone\Release
35 | prompt
36 | 4
37 | false
38 | iPhone Developer
39 | bin\iPhone\Release\SegmentedControl.FormsPlugin.iOS.XML
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll
52 |
53 |
54 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll
55 |
56 |
57 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll
58 |
59 |
60 | ..\..\packages\Xamarin.Forms.2.5.0.121934\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll
61 |
62 |
63 |
64 |
65 | {CDD2F7A1-0DED-481C-9C4D-4CD0CAE031B5}
66 | SegmentedControl.FormsPlugin.Abstractions
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.iOS/SegmentedControlImplementation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xamarin.Forms;
3 | using SegmentedControl.FormsPlugin.iOS;
4 | using Xamarin.Forms.Platform.iOS;
5 | using UIKit;
6 |
7 | [assembly: ExportRenderer(typeof(SegmentedControl.FormsPlugin.Abstractions.SegmentedControl), typeof(SegmentedControlRenderer))]
8 | namespace SegmentedControl.FormsPlugin.iOS
9 | {
10 | ///
11 | /// SegmentedControl Renderer
12 | ///
13 | public class SegmentedControlRenderer : ViewRenderer
14 | {
15 | UISegmentedControl nativeControl;
16 |
17 | protected override void OnElementChanged(ElementChangedEventArgs e)
18 | {
19 | base.OnElementChanged(e);
20 |
21 | if (Control == null)
22 | {
23 | // Instantiate the native control and assign it to the Control property with
24 | // the SetNativeControl method
25 |
26 | nativeControl = new UISegmentedControl();
27 |
28 | for (var i = 0; i
120 | /// Used for registration with dependency service
121 | ///
122 | public static void Init()
123 | {
124 | var temp = DateTime.Now;
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/SegmentedControl/SegmentedControl.FormsPlugin.iOS/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/UWP/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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 SegmentedControl.FormsPlugin.UWP;
10 |
11 | namespace Demo.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 | Frame rootFrame = Window.Current.Content as Frame;
42 |
43 | // Do not repeat app initialization when the Window already has content,
44 | // just ensure that the window is active
45 | if (rootFrame == null)
46 | {
47 | // Create a Frame to act as the navigation context and navigate to the first page
48 | rootFrame = new Frame();
49 |
50 | rootFrame.NavigationFailed += OnNavigationFailed;
51 |
52 | List assembliesToInclude = new List();
53 | assembliesToInclude.Add(typeof(SegmentedControlRenderer).GetTypeInfo().Assembly);
54 | Xamarin.Forms.Forms.Init(e, assembliesToInclude);
55 |
56 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
57 | {
58 | //TODO: Load state from previously suspended application
59 | }
60 |
61 | // Place the frame in the current Window
62 | Window.Current.Content = rootFrame;
63 | }
64 |
65 | if (e.PrelaunchActivated == false)
66 | {
67 | if (rootFrame.Content == null)
68 | {
69 | // When the navigation stack isn't restored navigate to the first page,
70 | // configuring the new page by passing required information as a navigation
71 | // parameter
72 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
73 | }
74 | // Ensure the current window is active
75 | Window.Current.Activate();
76 | }
77 | }
78 |
79 | ///
80 | /// Invoked when Navigation to a certain page fails
81 | ///
82 | /// The Frame which failed navigation
83 | /// Details about the navigation failure
84 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
85 | {
86 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
87 | }
88 |
89 | ///
90 | /// Invoked when application execution is being suspended. Application state is saved
91 | /// without knowing whether the application will be terminated or resumed with the contents
92 | /// of memory still intact.
93 | ///
94 | /// The source of the suspend request.
95 | /// Details about the suspend request.
96 | private void OnSuspending(object sender, SuspendingEventArgs e)
97 | {
98 | var deferral = e.SuspendingOperation.GetDeferral();
99 | //TODO: Save application state and stop any background activity
100 | deferral.Complete();
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/UWP/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/UWP/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/UWP/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/UWP/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/UWP/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/UWP/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/UWP/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/UWP/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/UWP/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/UWP/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/UWP/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/UWP/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/UWP/Assets/c1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/UWP/Assets/c1.jpg
--------------------------------------------------------------------------------
/UWP/Assets/c2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/UWP/Assets/c2.jpg
--------------------------------------------------------------------------------
/UWP/Assets/c3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/UWP/Assets/c3.jpg
--------------------------------------------------------------------------------
/UWP/Demo.UWP.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | {D1912CD5-0A3E-404C-8CAD-B786742BC926}
8 | AppContainerExe
9 | Properties
10 | Demo.UWP
11 | Demo.UWP
12 | en-US
13 | UAP
14 | 10.0.16299.0
15 | 10.0.16299.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | Demo.UWP_TemporaryKey.pfx
20 | 3.1.1
21 | win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot
22 |
23 |
24 | true
25 | bin\x86\Debug\
26 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
27 | ;2008
28 | full
29 | x86
30 | false
31 | prompt
32 | true
33 | false
34 |
35 |
36 | bin\x86\Release\
37 | TRACE;NETFX_CORE;WINDOWS_UWP
38 | true
39 | ;2008
40 | pdbonly
41 | x86
42 | false
43 | prompt
44 | true
45 | true
46 |
47 |
48 | true
49 | bin\ARM\Debug\
50 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
51 | ;2008
52 | full
53 | ARM
54 | false
55 | prompt
56 | true
57 |
58 |
59 | bin\ARM\Release\
60 | TRACE;NETFX_CORE;WINDOWS_UWP
61 | true
62 | ;2008
63 | pdbonly
64 | ARM
65 | false
66 | prompt
67 | true
68 | true
69 |
70 |
71 | true
72 | bin\x64\Debug\
73 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
74 | ;2008
75 | full
76 | x64
77 | false
78 | prompt
79 | true
80 |
81 |
82 | bin\x64\Release\
83 | TRACE;NETFX_CORE;WINDOWS_UWP
84 | true
85 | ;2008
86 | pdbonly
87 | x64
88 | false
89 | prompt
90 | true
91 | true
92 |
93 |
94 |
95 | App.xaml
96 |
97 |
98 | MainPage.xaml
99 |
100 |
101 |
102 |
103 |
104 | Designer
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | MSBuild:Compile
123 | Designer
124 |
125 |
126 | MSBuild:Compile
127 | Designer
128 |
129 |
130 |
131 |
132 | {c9bc51ac-22bd-4471-befd-d41d865c0b33}
133 | Demo
134 |
135 |
136 | {cdd2f7a1-0ded-481c-9c4d-4cd0cae031b5}
137 | SegmentedControl.FormsPlugin.Abstractions
138 |
139 |
140 | {9dd9f8e8-4a69-47af-a7ef-73ca9c3f80ea}
141 | SegmentedControl.FormsPlugin.UWP
142 |
143 |
144 |
145 |
146 | 6.0.1
147 |
148 |
149 | 2.3.1
150 |
151 |
152 | 2.5.0.121934
153 |
154 |
155 |
156 | 14.0
157 |
158 |
159 |
166 |
--------------------------------------------------------------------------------
/UWP/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/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 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
17 |
18 | namespace Demo.UWP
19 | {
20 | ///
21 | /// An empty page that can be used on its own or navigated to within a Frame.
22 | ///
23 | public sealed partial class MainPage
24 | {
25 | public MainPage()
26 | {
27 | this.InitializeComponent();
28 |
29 | LoadApplication(new Demo.App());
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/UWP/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 | Demo.UWP
18 | Alex Rainman
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 |
--------------------------------------------------------------------------------
/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("Demo.UWP")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Demo.UWP")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
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)]
--------------------------------------------------------------------------------
/UWP/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/iOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using Foundation;
6 | using SegmentedControl.FormsPlugin.iOS;
7 | using UIKit;
8 |
9 | namespace Demo.iOS
10 | {
11 | [Register("AppDelegate")]
12 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
13 | {
14 | public override bool FinishedLaunching(UIApplication app, NSDictionary options)
15 | {
16 | global::Xamarin.Forms.Forms.Init();
17 |
18 | SegmentedControlRenderer.Init();
19 |
20 | LoadApplication(new App());
21 |
22 | return base.FinishedLaunching(app, options);
23 | }
24 | }
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/iOS/Assets.xcassets/AppIcons.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "idiom": "iphone",
5 | "size": "29x29",
6 | "scale": "1x"
7 | },
8 | {
9 | "idiom": "iphone",
10 | "size": "29x29",
11 | "scale": "2x"
12 | },
13 | {
14 | "idiom": "iphone",
15 | "size": "29x29",
16 | "scale": "3x"
17 | },
18 | {
19 | "idiom": "iphone",
20 | "size": "40x40",
21 | "scale": "2x"
22 | },
23 | {
24 | "idiom": "iphone",
25 | "size": "40x40",
26 | "scale": "3x"
27 | },
28 | {
29 | "idiom": "iphone",
30 | "size": "57x57",
31 | "scale": "1x"
32 | },
33 | {
34 | "idiom": "iphone",
35 | "size": "57x57",
36 | "scale": "2x"
37 | },
38 | {
39 | "idiom": "iphone",
40 | "size": "60x60",
41 | "scale": "2x"
42 | },
43 | {
44 | "idiom": "iphone",
45 | "size": "60x60",
46 | "scale": "3x"
47 | },
48 | {
49 | "idiom": "ipad",
50 | "size": "29x29",
51 | "scale": "1x"
52 | },
53 | {
54 | "idiom": "ipad",
55 | "size": "29x29",
56 | "scale": "2x"
57 | },
58 | {
59 | "idiom": "ipad",
60 | "size": "40x40",
61 | "scale": "1x"
62 | },
63 | {
64 | "idiom": "ipad",
65 | "size": "40x40",
66 | "scale": "2x"
67 | },
68 | {
69 | "idiom": "ipad",
70 | "size": "50x50",
71 | "scale": "1x"
72 | },
73 | {
74 | "idiom": "ipad",
75 | "size": "50x50",
76 | "scale": "2x"
77 | },
78 | {
79 | "idiom": "ipad",
80 | "size": "72x72",
81 | "scale": "1x"
82 | },
83 | {
84 | "idiom": "ipad",
85 | "size": "72x72",
86 | "scale": "2x"
87 | },
88 | {
89 | "idiom": "ipad",
90 | "size": "76x76",
91 | "scale": "1x"
92 | },
93 | {
94 | "idiom": "ipad",
95 | "size": "76x76",
96 | "scale": "2x"
97 | },
98 | {
99 | "size": "24x24",
100 | "idiom": "watch",
101 | "scale": "2x",
102 | "role": "notificationCenter",
103 | "subtype": "38mm"
104 | },
105 | {
106 | "size": "27.5x27.5",
107 | "idiom": "watch",
108 | "scale": "2x",
109 | "role": "notificationCenter",
110 | "subtype": "42mm"
111 | },
112 | {
113 | "size": "29x29",
114 | "idiom": "watch",
115 | "role": "companionSettings",
116 | "scale": "2x"
117 | },
118 | {
119 | "size": "29x29",
120 | "idiom": "watch",
121 | "role": "companionSettings",
122 | "scale": "3x"
123 | },
124 | {
125 | "size": "40x40",
126 | "idiom": "watch",
127 | "scale": "2x",
128 | "role": "appLauncher",
129 | "subtype": "38mm"
130 | },
131 | {
132 | "size": "44x44",
133 | "idiom": "watch",
134 | "scale": "2x",
135 | "role": "longLook",
136 | "subtype": "42mm"
137 | },
138 | {
139 | "size": "86x86",
140 | "idiom": "watch",
141 | "scale": "2x",
142 | "role": "quickLook",
143 | "subtype": "38mm"
144 | },
145 | {
146 | "size": "98x98",
147 | "idiom": "watch",
148 | "scale": "2x",
149 | "role": "quickLook",
150 | "subtype": "42mm"
151 | }
152 | ],
153 | "info": {
154 | "version": 1,
155 | "author": "xcode"
156 | }
157 | }
--------------------------------------------------------------------------------
/iOS/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/iOS/Demo.iOS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | iPhoneSimulator
7 | {71701994-F330-4D8D-9351-42A39C26B737}
8 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
9 | Exe
10 | Demo.iOS
11 | Demo.iOS
12 | Resources
13 | 1.2.4
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\iPhoneSimulator\Debug
20 | DEBUG;ENABLE_TEST_CLOUD;
21 | prompt
22 | 4
23 | false
24 | iPhone Developer
25 | true
26 | true
27 | true
28 | None
29 | x86_64
30 | HttpClientHandler
31 | Default
32 | false
33 |
34 |
35 | true
36 | bin\iPhone\Release
37 |
38 |
39 | prompt
40 | 4
41 | false
42 | iPhone Developer
43 | true
44 | Entitlements.plist
45 | SdkOnly
46 | ARMv7, ARM64
47 | HttpClientHandler
48 | Default
49 |
50 |
51 | true
52 | bin\iPhoneSimulator\Release
53 |
54 |
55 | prompt
56 | 4
57 | false
58 | iPhone Developer
59 | None
60 | i386
61 | HttpClientHandler
62 | Default
63 |
64 |
65 | true
66 | full
67 | false
68 | bin\iPhone\Debug
69 | DEBUG;ENABLE_TEST_CLOUD;
70 | prompt
71 | 4
72 | false
73 | iPhone Developer
74 | true
75 | true
76 | true
77 | true
78 | true
79 | Entitlements.plist
80 | SdkOnly
81 | ARMv7, ARM64
82 | HttpClientHandler
83 | Default
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll
92 |
93 |
94 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll
95 |
96 |
97 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll
98 |
99 |
100 | ..\packages\Xamarin.Forms.2.5.0.121934\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll
101 |
102 |
103 |
104 |
105 | false
106 |
107 |
108 | false
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 | {D525F236-6A2D-4010-B1CC-4A4B8581C90B}
129 | SegmentedControl.FormsPlugin.iOS
130 |
131 |
132 | {CDD2F7A1-0DED-481C-9C4D-4CD0CAE031B5}
133 | SegmentedControl.FormsPlugin.Abstractions
134 |
135 |
136 | {4A1D8886-EB55-4B3E-8F4B-1116463DC387}
137 | Demo
138 |
139 |
140 |
141 |
142 |
--------------------------------------------------------------------------------
/iOS/Entitlements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDisplayName
6 | Demo
7 | CFBundleName
8 | Demo
9 | CFBundleIdentifier
10 | com.slbdev.demo.ios
11 | CFBundleShortVersionString
12 | 1.0
13 | CFBundleVersion
14 | 1.0
15 | LSRequiresIPhoneOS
16 |
17 | MinimumOSVersion
18 | 8.0
19 | UIDeviceFamily
20 |
21 | 1
22 | 2
23 |
24 | UILaunchStoryboardName
25 | LaunchScreen
26 | UIRequiredDeviceCapabilities
27 |
28 | armv7
29 |
30 | UISupportedInterfaceOrientations
31 |
32 | UIInterfaceOrientationPortrait
33 | UIInterfaceOrientationLandscapeLeft
34 | UIInterfaceOrientationLandscapeRight
35 |
36 | UISupportedInterfaceOrientations~ipad
37 |
38 | UIInterfaceOrientationPortrait
39 | UIInterfaceOrientationPortraitUpsideDown
40 | UIInterfaceOrientationLandscapeLeft
41 | UIInterfaceOrientationLandscapeRight
42 |
43 | XSAppIconAssets
44 | Assets.xcassets/AppIcons.appiconset
45 |
46 |
47 |
--------------------------------------------------------------------------------
/iOS/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 |
--------------------------------------------------------------------------------
/iOS/Main.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using Foundation;
6 | using UIKit;
7 |
8 | namespace Demo.iOS
9 | {
10 | public class Application
11 | {
12 | // This is the main entry point of the application.
13 | static void Main(string[] args)
14 | {
15 | // if you want to use a different Application Delegate class from "AppDelegate"
16 | // you can specify it here.
17 | UIApplication.Main(args, null, "AppDelegate");
18 | }
19 | }
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/iOS/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/license.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 alexrainman1975@gmail.com
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 |
--------------------------------------------------------------------------------
/nuget/SegmentedControl.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SegmentedControl.FormsPlugin
5 | 2.0.1
6 | Segmented Control for Xamarin Forms
7 | Alex Rainman
8 | Alex Rainman
9 | https://github.com/alexrainman/SegmentedControl/blob/master/README.md
10 | https://github.com/alexrainman/SegmentedControl
11 | false
12 | Segmented Control for Xamarin Forms
13 | Segmented Control for Xamarin Forms
14 |
15 | 2.0.1
16 | [Android] Segmented Control Not Displaying on Second Page #71
17 | 2.0.0
18 | [Update] Adding support for netstandard2.0
19 | [Update] Adding support for UWP
20 | [Update] Adding DisabledColor bindable property
21 | 1.3.4
22 | [Android] Setting SelectedSegment to -1 to clear selection throws error in Android #61
23 | [Update] Changing ValueChanged to event to make it available from XAML
24 | 1.3.3
25 | [Update] Adding support for no segment selected
26 | [Update] Preventing crashes OnElementPropertyChanged because Element or NativeControl are null.
27 | 1.3.2
28 | [Android] Segmented Control Not Displaying on Second Page #51
29 | [Android] About 150 warnings about resources #50
30 | [Android] Android package incompatible with latest Xamarin Forms #48
31 | [Android] Segmented Control Not rendering in Android #46
32 | [Android] Late instantiation of the RadioGroup control in the Android renderer fails to display bug #45
33 | [Android] Object Disposed Exception. Crash. Android only #44
34 | [Android] Segmented control changed displaying inside Grid #42
35 | [Update] Doesn't work with Xamarin.Forms Previewer #49
36 | 1.3.1
37 | [Android] Regression: control is not displayed anymore on Android #36 fixed.
38 | 1.3.0
39 | [Update] SelectedText property deprecated.
40 | [Update] SelectTab method deprecated (changed SelectedSegment property instead).
41 | [Update] ChangeTintColor method deprecated (change TintColor property instead).
42 | [iOS] SelectedTextColor property implemented.
43 | [Android] Strange colors with disabled android control #16 (fixed).
44 | [Android] Blue color on first and third control #19 (fixed).
45 | [Android] SegmentedControlOption are getting duplicated on android rotation #23 (fixed).
46 | [Android] TintColor not getting set #26 (fixed).
47 | [Android] Segment Text Misaligns when page is left, returned to #30 (fixed).
48 | 1.2.4
49 | [Android] #14 IsEnabled has no effect on Android (fixed)
50 | 1.2.3
51 | [Android] #14 IsEnabled has no effect on Android (fixed)
52 | 1.2.2
53 | [Android] Adding SelectedTextColor property to match iOS control behavior
54 | [Android] Fixing bug #11 Invalid cast exception. Android platform
55 | 1.2.1
56 | [Android] Matching tint color behavior with iOS control
57 |
58 | segmented control ios android uwp xamarin forms monotouch monodroid
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 |
--------------------------------------------------------------------------------
/nuget/lib/Portable/SegmentedControl.FormsPlugin.Abstractions.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/nuget/lib/Portable/SegmentedControl.FormsPlugin.Abstractions.dll
--------------------------------------------------------------------------------
/nuget/lib/SegmentedControl.FormsPlugin.Abstractions.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/nuget/lib/SegmentedControl.FormsPlugin.Abstractions.dll
--------------------------------------------------------------------------------
/nuget/lib/SegmentedControl.FormsPlugin.Android.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/nuget/lib/SegmentedControl.FormsPlugin.Android.dll
--------------------------------------------------------------------------------
/nuget/lib/SegmentedControl.FormsPlugin.UWP.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/nuget/lib/SegmentedControl.FormsPlugin.UWP.dll
--------------------------------------------------------------------------------
/nuget/lib/SegmentedControl.FormsPlugin.UWP.pri:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/nuget/lib/SegmentedControl.FormsPlugin.UWP.pri
--------------------------------------------------------------------------------
/nuget/lib/SegmentedControl.FormsPlugin.UWP.xr.xml:
--------------------------------------------------------------------------------
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 |
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 |
--------------------------------------------------------------------------------
/nuget/lib/SegmentedControl.FormsPlugin.iOS.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/nuget/lib/SegmentedControl.FormsPlugin.iOS.dll
--------------------------------------------------------------------------------
/nuget/lib/SegmentedRadioButtonStyle.xbf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/nuget/lib/SegmentedRadioButtonStyle.xbf
--------------------------------------------------------------------------------
/nuget/lib/SegmentedUserControl.xbf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/nuget/lib/SegmentedUserControl.xbf
--------------------------------------------------------------------------------
/nuget/output/SegmentedControl.FormsPlugin.2.0.1.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexrainman/SegmentedControl/b9d081733290b88778bc118797bab194d5591868/nuget/output/SegmentedControl.FormsPlugin.2.0.1.nupkg
--------------------------------------------------------------------------------
/packages/repositories.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------