├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── PackageCI.yml │ └── PrCheck.yml ├── .gitignore ├── Images └── Icon.png ├── LICENSE ├── README.md ├── Xamarin.Forms.NeoControls.Demo.Android ├── Assets │ └── AboutAssets.txt ├── MainActivity.cs ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── Resources │ ├── AboutResources.txt │ ├── Resource.designer.cs │ ├── layout │ │ ├── Tabbar.xml │ │ └── Toolbar.xml │ ├── mipmap-anydpi-v26 │ │ ├── icon.xml │ │ └── icon_round.xml │ ├── mipmap-hdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-mdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xxhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xxxhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ └── values │ │ ├── colors.xml │ │ └── styles.xml └── Xamarin.Forms.NeoControls.Demo.Android.csproj ├── Xamarin.Forms.NeoControls.Demo.iOS ├── AppDelegate.cs ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon1024.png │ │ ├── Icon120.png │ │ ├── Icon152.png │ │ ├── Icon167.png │ │ ├── Icon180.png │ │ ├── Icon20.png │ │ ├── Icon29.png │ │ ├── Icon40.png │ │ ├── Icon58.png │ │ ├── Icon60.png │ │ ├── Icon76.png │ │ ├── Icon80.png │ │ └── Icon87.png ├── Entitlements.plist ├── Info.plist ├── Main.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── Default-568h@2x.png │ ├── Default-Portrait.png │ ├── Default-Portrait@2x.png │ ├── Default.png │ ├── Default@2x.png │ └── LaunchScreen.storyboard └── Xamarin.Forms.NeoControls.Demo.iOS.csproj ├── Xamarin.Forms.NeoControls.Demo.sln ├── Xamarin.Forms.NeoControls.Demo ├── App.xaml ├── App.xaml.cs ├── AssemblyInfo.cs ├── MainPage.xaml ├── MainPage.xaml.cs └── Xamarin.Forms.NeoControls.Demo.csproj ├── Xamarin.Forms.NeoControls.sln └── Xamarin.Forms.NeoControls ├── Abstractions ├── IWithCanvasElement.cs └── IWithParentElement.cs ├── Enums ├── ClickMode.cs ├── DrawMode.cs └── ShadowMode.cs ├── Extensions ├── ColorExtensions.cs ├── SkPathExtensions.cs └── TaskExtensions.cs ├── Gradient.cs ├── GradientElements.cs ├── GradientStop.cs ├── LinearGradient.cs ├── NeoButton.cs ├── NeoFrame.cs ├── NeoProgressView.cs ├── NeoRoundedView.cs ├── NeoView.xaml ├── NeoView.xaml.cs ├── Properties ├── AssemblyInfo.cs └── PreserveNeoControlsAttribute.cs ├── Renderers ├── LinearGradientRenderer.cs └── RenderContext.cs ├── Xamarin.Forms.NeoControls.csproj └── build ├── PreserveNeoControls.cs └── Xamarin.Forms.NeoControls.targets /.editorconfig: -------------------------------------------------------------------------------- 1 | # Rules in this file were initially inferred by Visual Studio IntelliCode from the C:\Users\felip\source\repos\Xamarin.Forms.NeoControls codebase based on best match to current usage at 25/01/2021 2 | # You can modify the rules from these initially generated values to suit your own policies 3 | # You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference 4 | [*.cs] 5 | 6 | 7 | #Core editorconfig formatting - indentation 8 | 9 | #use soft tabs (spaces) for indentation 10 | indent_style = space 11 | 12 | #Formatting - new line options 13 | 14 | #place catch statements on a new line 15 | csharp_new_line_before_catch = true 16 | #place else statements on a new line 17 | csharp_new_line_before_else = true 18 | #require finally statements to be on a new line after the closing brace 19 | csharp_new_line_before_finally = true 20 | #require braces to be on a new line for properties, accessors, methods, control_blocks, and types (also known as "Allman" style) 21 | csharp_new_line_before_open_brace = properties, accessors, methods, control_blocks, types 22 | 23 | #Formatting - organize using options 24 | 25 | #do not place System.* using directives before other using directives 26 | dotnet_sort_system_directives_first = false 27 | 28 | #Formatting - spacing options 29 | 30 | #require NO space between a cast and the value 31 | csharp_space_after_cast = false 32 | #require a space before the colon for bases or interfaces in a type declaration 33 | csharp_space_after_colon_in_inheritance_clause = true 34 | #require a space after a keyword in a control flow statement such as a for loop 35 | csharp_space_after_keywords_in_control_flow_statements = true 36 | #require a space before the colon for bases or interfaces in a type declaration 37 | csharp_space_before_colon_in_inheritance_clause = true 38 | #remove space within empty argument list parentheses 39 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 40 | #remove space between method call name and opening parenthesis 41 | csharp_space_between_method_call_name_and_opening_parenthesis = false 42 | #do not place space characters after the opening parenthesis and before the closing parenthesis of a method call 43 | csharp_space_between_method_call_parameter_list_parentheses = false 44 | #remove space within empty parameter list parentheses for a method declaration 45 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 46 | #place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list. 47 | csharp_space_between_method_declaration_parameter_list_parentheses = false 48 | 49 | #Formatting - wrapping options 50 | 51 | #leave code block on separate lines 52 | csharp_preserve_single_line_blocks = false 53 | 54 | #Style - Code block preferences 55 | 56 | #prefer no curly braces if allowed 57 | csharp_prefer_braces = false:suggestion 58 | 59 | #Style - expression bodied member options 60 | 61 | #prefer expression-bodied members for accessors 62 | csharp_style_expression_bodied_accessors = true:suggestion 63 | #prefer expression-bodied members for constructors 64 | csharp_style_expression_bodied_constructors = true:suggestion 65 | #prefer block bodies for methods 66 | csharp_style_expression_bodied_methods = false:suggestion 67 | #prefer expression-bodied members for properties 68 | csharp_style_expression_bodied_properties = true:suggestion 69 | 70 | #Style - Expression-level preferences 71 | 72 | #prefer inferred tuple element names 73 | dotnet_style_prefer_inferred_tuple_names = true:suggestion 74 | 75 | #Style - implicit and explicit types 76 | 77 | #prefer var over explicit type in all cases, unless overridden by another code style rule 78 | csharp_style_var_elsewhere = true:suggestion 79 | #prefer var is used to declare variables with built-in system types such as int 80 | csharp_style_var_for_built_in_types = true:suggestion 81 | #prefer var when the type is already mentioned on the right-hand side of a declaration expression 82 | csharp_style_var_when_type_is_apparent = true:suggestion 83 | 84 | #Style - language keyword and framework type options 85 | 86 | #prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them 87 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion 88 | 89 | #Style - Miscellaneous preferences 90 | 91 | #prefer local functions over anonymous functions 92 | csharp_style_pattern_local_over_anonymous_function = true:suggestion 93 | 94 | #Style - modifier options 95 | 96 | #prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods. 97 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion 98 | 99 | #Style - Modifier preferences 100 | 101 | #when this rule is set to a list of modifiers, prefer the specified ordering. 102 | csharp_preferred_modifier_order = public,protected,private,internal,static,readonly,override,virtual,abstract,async,new,sealed:suggestion 103 | 104 | #Style - Pattern matching 105 | 106 | #prefer pattern matching instead of is expression with type casts 107 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion 108 | 109 | #Style - qualification options 110 | 111 | #prefer events not to be prefaced with this. or Me. in Visual Basic 112 | dotnet_style_qualification_for_event = false:suggestion 113 | #prefer fields not to be prefaced with this. or Me. in Visual Basic 114 | dotnet_style_qualification_for_field = false:suggestion 115 | #prefer methods not to be prefaced with this. or Me. in Visual Basic 116 | dotnet_style_qualification_for_method = false:suggestion 117 | #prefer properties not to be prefaced with this. or Me. in Visual Basic 118 | dotnet_style_qualification_for_property = false:suggestion 119 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: felipebaltazar # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: felipebaltazar 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Overview 2 | 3 | 4 | 5 | ### Issues Resolved 6 | 7 | 8 | - fixes # 9 | 10 | ### API Changes 11 | 12 | 13 | None 14 | 15 | ### Platforms Affected 16 | 17 | 18 | - All 19 | - iOS 20 | - Android 21 | - UWP 22 | 23 | ### Behavioral Changes 24 | 25 | 26 | None 27 | 28 | ### Testing Procedure 29 | 30 | 31 | ### PR Checklist ### 32 | 33 | - [ ] Rebased on top of the target branch at time of PR 34 | - [ ] Changes adhere to coding standard -------------------------------------------------------------------------------- /.github/workflows/PackageCI.yml: -------------------------------------------------------------------------------- 1 | name: Build and publish packages 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | 7 | jobs: 8 | build: 9 | 10 | name: Build and publish package 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: Setup .NET Core 16 | uses: actions/setup-dotnet@v1 17 | with: 18 | dotnet-version: 3.1.200 19 | - name: Build 20 | run: dotnet build ./Xamarin.Forms.NeoControls/Xamarin.Forms.NeoControls.csproj --configuration Release 21 | - name: Pack 22 | run: dotnet pack ./Xamarin.Forms.NeoControls/Xamarin.Forms.NeoControls.csproj --output ./artifacts --configuration Release 23 | - name: Push Nupkg to GitHub Packages 24 | uses: tanaka-takayoshi/nuget-publish-to-github-packages-action@v2.1 25 | with: 26 | nupkg-path: './artifacts/*.nupkg' 27 | repo-owner: 'felipebaltazar' 28 | gh-user: 'felipebaltazar' 29 | token: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/PrCheck.yml: -------------------------------------------------------------------------------- 1 | name: Build Xamarin.Forms.NeoControls 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | build: 7 | 8 | name: Build with dotnet 9 | runs-on: windows-latest 10 | 11 | steps: 12 | - uses: actions/checkout@v1 13 | - name: Setup .NET Core 14 | uses: actions/setup-dotnet@v1 15 | with: 16 | dotnet-version: 3.1.200 17 | - name: Build with dotnet core 18 | run: dotnet build Xamarin.Forms.NeoControls.sln --configuration Release 19 | 20 | analyze: 21 | 22 | name: Analyze 23 | runs-on: ubuntu-latest 24 | 25 | strategy: 26 | fail-fast: false 27 | matrix: 28 | language: [ 'csharp' ] 29 | 30 | steps: 31 | - name: Checkout repository 32 | uses: actions/checkout@v2 33 | 34 | - name: Initialize CodeQL 35 | uses: github/codeql-action/init@v1 36 | with: 37 | languages: ${{ matrix.language }} 38 | 39 | - name: Setup .NET Core 40 | uses: actions/setup-dotnet@v1 41 | with: 42 | dotnet-version: 3.1.200 43 | 44 | - name: Build solution 45 | run: dotnet build Xamarin.Forms.NeoControls.sln --configuration Release 46 | 47 | - name: Perform CodeQL Analysis 48 | uses: github/codeql-action/analyze@v1 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # JustCode is a .NET coding add-in 131 | .JustCode 132 | 133 | # TeamCity is a build add-in 134 | _TeamCity* 135 | 136 | # DotCover is a Code Coverage Tool 137 | *.dotCover 138 | 139 | # AxoCover is a Code Coverage Tool 140 | .axoCover/* 141 | !.axoCover/settings.json 142 | 143 | # Visual Studio code coverage results 144 | *.coverage 145 | *.coveragexml 146 | 147 | # NCrunch 148 | _NCrunch_* 149 | .*crunch*.local.xml 150 | nCrunchTemp_* 151 | 152 | # MightyMoose 153 | *.mm.* 154 | AutoTest.Net/ 155 | 156 | # Web workbench (sass) 157 | .sass-cache/ 158 | 159 | # Installshield output folder 160 | [Ee]xpress/ 161 | 162 | # DocProject is a documentation generator add-in 163 | DocProject/buildhelp/ 164 | DocProject/Help/*.HxT 165 | DocProject/Help/*.HxC 166 | DocProject/Help/*.hhc 167 | DocProject/Help/*.hhk 168 | DocProject/Help/*.hhp 169 | DocProject/Help/Html2 170 | DocProject/Help/html 171 | 172 | # Click-Once directory 173 | publish/ 174 | 175 | # Publish Web Output 176 | *.[Pp]ublish.xml 177 | *.azurePubxml 178 | # Note: Comment the next line if you want to checkin your web deploy settings, 179 | # but database connection strings (with potential passwords) will be unencrypted 180 | *.pubxml 181 | *.publishproj 182 | 183 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 184 | # checkin your Azure Web App publish settings, but sensitive information contained 185 | # in these scripts will be unencrypted 186 | PublishScripts/ 187 | 188 | # NuGet Packages 189 | *.nupkg 190 | # NuGet Symbol Packages 191 | *.snupkg 192 | # The packages folder can be ignored because of Package Restore 193 | **/[Pp]ackages/* 194 | # except build/, which is used as an MSBuild target. 195 | !**/[Pp]ackages/build/ 196 | # Uncomment if necessary however generally it will be regenerated when needed 197 | #!**/[Pp]ackages/repositories.config 198 | # NuGet v3's project.json files produces more ignorable files 199 | *.nuget.props 200 | *.nuget.targets 201 | 202 | # Microsoft Azure Build Output 203 | csx/ 204 | *.build.csdef 205 | 206 | # Microsoft Azure Emulator 207 | ecf/ 208 | rcf/ 209 | 210 | # Windows Store app package directories and files 211 | AppPackages/ 212 | BundleArtifacts/ 213 | Package.StoreAssociation.xml 214 | _pkginfo.txt 215 | *.appx 216 | *.appxbundle 217 | *.appxupload 218 | 219 | # Visual Studio cache files 220 | # files ending in .cache can be ignored 221 | *.[Cc]ache 222 | # but keep track of directories ending in .cache 223 | !?*.[Cc]ache/ 224 | 225 | # Others 226 | ClientBin/ 227 | ~$* 228 | *~ 229 | *.dbmdl 230 | *.dbproj.schemaview 231 | *.jfm 232 | *.pfx 233 | *.publishsettings 234 | orleans.codegen.cs 235 | 236 | # Including strong name files can present a security risk 237 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 238 | #*.snk 239 | 240 | # Since there are multiple workflows, uncomment next line to ignore bower_components 241 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 242 | #bower_components/ 243 | 244 | # RIA/Silverlight projects 245 | Generated_Code/ 246 | 247 | # Backup & report files from converting an old project file 248 | # to a newer Visual Studio version. Backup files are not needed, 249 | # because we have git ;-) 250 | _UpgradeReport_Files/ 251 | Backup*/ 252 | UpgradeLog*.XML 253 | UpgradeLog*.htm 254 | ServiceFabricBackup/ 255 | *.rptproj.bak 256 | 257 | # SQL Server files 258 | *.mdf 259 | *.ldf 260 | *.ndf 261 | 262 | # Business Intelligence projects 263 | *.rdl.data 264 | *.bim.layout 265 | *.bim_*.settings 266 | *.rptproj.rsuser 267 | *- [Bb]ackup.rdl 268 | *- [Bb]ackup ([0-9]).rdl 269 | *- [Bb]ackup ([0-9][0-9]).rdl 270 | 271 | # Microsoft Fakes 272 | FakesAssemblies/ 273 | 274 | # GhostDoc plugin setting file 275 | *.GhostDoc.xml 276 | 277 | # Node.js Tools for Visual Studio 278 | .ntvs_analysis.dat 279 | node_modules/ 280 | 281 | # Visual Studio 6 build log 282 | *.plg 283 | 284 | # Visual Studio 6 workspace options file 285 | *.opt 286 | 287 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 288 | *.vbw 289 | 290 | # Visual Studio LightSwitch build output 291 | **/*.HTMLClient/GeneratedArtifacts 292 | **/*.DesktopClient/GeneratedArtifacts 293 | **/*.DesktopClient/ModelManifest.xml 294 | **/*.Server/GeneratedArtifacts 295 | **/*.Server/ModelManifest.xml 296 | _Pvt_Extensions 297 | 298 | # Paket dependency manager 299 | .paket/paket.exe 300 | paket-files/ 301 | 302 | # FAKE - F# Make 303 | .fake/ 304 | 305 | # CodeRush personal settings 306 | .cr/personal 307 | 308 | # Python Tools for Visual Studio (PTVS) 309 | __pycache__/ 310 | *.pyc 311 | 312 | # Cake - Uncomment if you are using it 313 | # tools/** 314 | # !tools/packages.config 315 | 316 | # Tabs Studio 317 | *.tss 318 | 319 | # Telerik's JustMock configuration file 320 | *.jmconfig 321 | 322 | # BizTalk build output 323 | *.btp.cs 324 | *.btm.cs 325 | *.odx.cs 326 | *.xsd.cs 327 | 328 | # OpenCover UI analysis results 329 | OpenCover/ 330 | 331 | # Azure Stream Analytics local run output 332 | ASALocalRun/ 333 | 334 | # MSBuild Binary and Structured Log 335 | *.binlog 336 | 337 | # NVidia Nsight GPU debugger configuration file 338 | *.nvuser 339 | 340 | # MFractors (Xamarin productivity tool) working folder 341 | .mfractor/ 342 | 343 | # Local History for Visual Studio 344 | .localhistory/ 345 | 346 | # BeatPulse healthcheck temp database 347 | healthchecksdb 348 | 349 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 350 | MigrationBackup/ 351 | 352 | # Ionide (cross platform F# VS Code tools) working folder 353 | .ionide/ 354 | -------------------------------------------------------------------------------- /Images/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Images/Icon.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Felipe Baltazar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Xamarin.Forms.NeoControls 2 | 3 | Controls for Xamarin Forms based on neumorphism tendency 4 | 5 | [![NuGet](https://img.shields.io/nuget/v/Xamarin.Forms.NeoControls.svg)](https://www.nuget.org/packages/Xamarin.Forms.NeoControls/) 6 | 7 | ### FOR MAUI MIGRATION 8 | https://github.com/felipebaltazar/Maui.NeoControls 9 | 10 | 11 | ## Examples 12 | 13 | https://github.com/felipebaltazar/NeomorphismSmartHomeApp 14 | 15 | ![example](https://user-images.githubusercontent.com/19656249/80289178-62cdbc00-8713-11ea-9333-5e13ad8bc7fc.gif) 16 | 17 | 18 | ## Getting started 19 | 20 | - Install the Xamarin.Forms.NeoControls package 21 | 22 | ``` 23 | Install-Package Xamarin.Forms.NeoControls -Version 1.1.0-pre 24 | ``` 25 | 26 | > No Xaml namespace declaration is needed 27 | - Use the controls 28 | 29 | ```xml 30 | 33 | ``` 34 | 35 | - You can also insert any view inside the neo controls 36 | 37 | ```xml 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | ``` 47 | 48 | - Background with gradient 49 | 50 | ```xml 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 63 | 64 | ``` 65 | ## Property reference 66 | 67 | | Property | What it does | Extra info | 68 | | ------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------- | 69 | | `CornerRadius` | A `CornerRadius` object representing each individual corner's radius. | Uses the `CornerRadius` struct allowing you to specify individual corners. | 70 | | `Elevation` | Set this value to chenge element depth effect. | | 71 | | `InnerView` | View that will be shown inside the neo control. | | 72 | | `ShadowBlur` | Set this value to change shadow blur effect. | | 73 | | `ShadowDistance` | Set this value to change shadow distance relative from control. | | 74 | | `DarkShadowColor` | The Dark color that will be applied on draw the dark shadow. | This will be applied with `Elevation` property, as Alpha parameter. | 75 | | `LightShadowColor` | The White color that will be applied on draw the light shadow. | | 76 | | `BackgroundGradient`| Draw a gradient on background's control | When value != null, backgroundColor Property will be ignored | 77 | 78 | 79 | ## Contributors 80 | * [Pablo Erick](https://github.com/pabloprogramador) - Contributor 81 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with 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 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 |  2 | using Android.App; 3 | using Android.Content.PM; 4 | using Android.OS; 5 | 6 | namespace Xamarin.Forms.NeoControls.Demo.Droid 7 | { 8 | [Activity(Label = "Xamarin.Forms.NeoControls.Demo", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )] 9 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 10 | { 11 | protected override void OnCreate(Bundle savedInstanceState) 12 | { 13 | TabLayoutResource = Resource.Layout.Tabbar; 14 | ToolbarResource = Resource.Layout.Toolbar; 15 | 16 | base.OnCreate(savedInstanceState); 17 | 18 | Xamarin.Essentials.Platform.Init(this, savedInstanceState); 19 | global::Xamarin.Forms.Forms.Init(this, savedInstanceState); 20 | LoadApplication(new App()); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.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("Xamarin.Forms.NeoControls.Demo.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Xamarin.Forms.NeoControls.Demo.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | [assembly: AssemblyVersion("1.0.0.0")] 26 | [assembly: AssemblyFileVersion("1.0.0.0")] 27 | 28 | // Add some common permissions, these can be removed if not needed 29 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)] 30 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)] 31 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.xml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable-hdpi/ 12 | icon.png 13 | 14 | drawable-ldpi/ 15 | icon.png 16 | 17 | drawable-mdpi/ 18 | icon.png 19 | 20 | layout/ 21 | main.xml 22 | 23 | values/ 24 | strings.xml 25 | 26 | In order to get the build system to recognize Android resources, set the build action to 27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 28 | instead operate on resource IDs. When you compile an Android application that uses resources, 29 | the build system will package the resources for distribution and generate a class called 30 | "Resource" that contains the tokens for each one of the resources included. For example, 31 | for the above Resources layout, this is what the Resource class would expose: 32 | 33 | public class Resource { 34 | public class drawable { 35 | public const int icon = 0x123; 36 | } 37 | 38 | public class layout { 39 | public const int main = 0x456; 40 | } 41 | 42 | public class strings { 43 | public const int first_string = 0xabc; 44 | public const int second_string = 0xbcd; 45 | } 46 | } 47 | 48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main 49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first 50 | string in the dictionary file values/strings.xml. 51 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/layout/Tabbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/layout/Toolbar.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-anydpi-v26/icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-anydpi-v26/icon_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-hdpi/icon.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-hdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-hdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-mdpi/icon.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-mdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-mdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xhdpi/icon.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xxxhdpi/icon.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #3F51B5 5 | #303F9F 6 | #FF4081 7 | 8 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.Android/Xamarin.Forms.NeoControls.Demo.Android.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F} 7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | {c9e5eea5-ca05-42a1-839b-61506e0a37df} 9 | Library 10 | Xamarin.Forms.NeoControls.Demo.Droid 11 | Xamarin.Forms.NeoControls.Demo.Android 12 | True 13 | True 14 | Resources\Resource.designer.cs 15 | Resource 16 | Properties\AndroidManifest.xml 17 | Resources 18 | Assets 19 | false 20 | v9.0 21 | true 22 | true 23 | Xamarin.Android.Net.AndroidClientHandler 24 | 25 | 26 | 27 | 28 | true 29 | portable 30 | false 31 | bin\Debug 32 | DEBUG; 33 | prompt 34 | 4 35 | None 36 | 37 | 38 | true 39 | portable 40 | true 41 | bin\Release 42 | prompt 43 | 4 44 | true 45 | false 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | {833852DE-5AA1-4A3B-AFB8-41E2DD88CBF0} 94 | Xamarin.Forms.NeoControls.Demo 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace Xamarin.Forms.NeoControls.Demo.iOS 9 | { 10 | // The UIApplicationDelegate for the application. This class is responsible for launching the 11 | // User Interface of the application, as well as listening (and optionally responding) to 12 | // application events from iOS. 13 | [Register("AppDelegate")] 14 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 15 | { 16 | // 17 | // This method is invoked when the application has loaded and is ready to run. In this 18 | // method you should instantiate the window, load the UI into it and then make the window 19 | // visible. 20 | // 21 | // You have 17 seconds to return from this method, or iOS will terminate your application. 22 | // 23 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 24 | { 25 | global::Xamarin.Forms.Forms.Init(); 26 | LoadApplication(new App()); 27 | 28 | return base.FinishedLaunching(app, options); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "scale": "2x", 5 | "size": "20x20", 6 | "idiom": "iphone", 7 | "filename": "Icon40.png" 8 | }, 9 | { 10 | "scale": "3x", 11 | "size": "20x20", 12 | "idiom": "iphone", 13 | "filename": "Icon60.png" 14 | }, 15 | { 16 | "scale": "2x", 17 | "size": "29x29", 18 | "idiom": "iphone", 19 | "filename": "Icon58.png" 20 | }, 21 | { 22 | "scale": "3x", 23 | "size": "29x29", 24 | "idiom": "iphone", 25 | "filename": "Icon87.png" 26 | }, 27 | { 28 | "scale": "2x", 29 | "size": "40x40", 30 | "idiom": "iphone", 31 | "filename": "Icon80.png" 32 | }, 33 | { 34 | "scale": "3x", 35 | "size": "40x40", 36 | "idiom": "iphone", 37 | "filename": "Icon120.png" 38 | }, 39 | { 40 | "scale": "2x", 41 | "size": "60x60", 42 | "idiom": "iphone", 43 | "filename": "Icon120.png" 44 | }, 45 | { 46 | "scale": "3x", 47 | "size": "60x60", 48 | "idiom": "iphone", 49 | "filename": "Icon180.png" 50 | }, 51 | { 52 | "scale": "1x", 53 | "size": "20x20", 54 | "idiom": "ipad", 55 | "filename": "Icon20.png" 56 | }, 57 | { 58 | "scale": "2x", 59 | "size": "20x20", 60 | "idiom": "ipad", 61 | "filename": "Icon40.png" 62 | }, 63 | { 64 | "scale": "1x", 65 | "size": "29x29", 66 | "idiom": "ipad", 67 | "filename": "Icon29.png" 68 | }, 69 | { 70 | "scale": "2x", 71 | "size": "29x29", 72 | "idiom": "ipad", 73 | "filename": "Icon58.png" 74 | }, 75 | { 76 | "scale": "1x", 77 | "size": "40x40", 78 | "idiom": "ipad", 79 | "filename": "Icon40.png" 80 | }, 81 | { 82 | "scale": "2x", 83 | "size": "40x40", 84 | "idiom": "ipad", 85 | "filename": "Icon80.png" 86 | }, 87 | { 88 | "scale": "1x", 89 | "size": "76x76", 90 | "idiom": "ipad", 91 | "filename": "Icon76.png" 92 | }, 93 | { 94 | "scale": "2x", 95 | "size": "76x76", 96 | "idiom": "ipad", 97 | "filename": "Icon152.png" 98 | }, 99 | { 100 | "scale": "2x", 101 | "size": "83.5x83.5", 102 | "idiom": "ipad", 103 | "filename": "Icon167.png" 104 | }, 105 | { 106 | "scale": "1x", 107 | "size": "1024x1024", 108 | "idiom": "ios-marketing", 109 | "filename": "Icon1024.png" 110 | } 111 | ], 112 | "properties": {}, 113 | "info": { 114 | "version": 1, 115 | "author": "xcode" 116 | } 117 | } -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIDeviceFamily 6 | 7 | 1 8 | 2 9 | 10 | UISupportedInterfaceOrientations 11 | 12 | UIInterfaceOrientationPortrait 13 | UIInterfaceOrientationLandscapeLeft 14 | UIInterfaceOrientationLandscapeRight 15 | 16 | UISupportedInterfaceOrientations~ipad 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationPortraitUpsideDown 20 | UIInterfaceOrientationLandscapeLeft 21 | UIInterfaceOrientationLandscapeRight 22 | 23 | MinimumOSVersion 24 | 8.0 25 | CFBundleDisplayName 26 | Xamarin.Forms.NeoControls.Demo 27 | CFBundleIdentifier 28 | com.companyname.Xamarin.Forms.NeoControls.Demo 29 | CFBundleVersion 30 | 1.0 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | CFBundleName 34 | Xamarin.Forms.NeoControls.Demo 35 | XSAppIconAssets 36 | Assets.xcassets/AppIcon.appiconset 37 | 38 | 39 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.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 Xamarin.Forms.NeoControls.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 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.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("Xamarin.Forms.NeoControls.Demo.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Xamarin.Forms.NeoControls.Demo.iOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Resources/Default.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipebaltazar/Xamarin.Forms.NeoControls/e9280999ecf11db99d54485343a960cb318ef121/Xamarin.Forms.NeoControls.Demo.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Resources/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.iOS/Xamarin.Forms.NeoControls.Demo.iOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | iPhoneSimulator 6 | 8.0.30703 7 | 2.0 8 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F} 9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | {6143fdea-f3c2-4a09-aafa-6e230626515e} 11 | Exe 12 | Xamarin.Forms.NeoControls.Demo.iOS 13 | Resources 14 | Xamarin.Forms.NeoControls.Demo.iOS 15 | true 16 | NSUrlSessionHandler 17 | automatic 18 | 19 | 20 | true 21 | full 22 | false 23 | bin\iPhoneSimulator\Debug 24 | DEBUG 25 | prompt 26 | 4 27 | x86_64 28 | None 29 | true 30 | 31 | 32 | none 33 | true 34 | bin\iPhoneSimulator\Release 35 | prompt 36 | 4 37 | None 38 | x86_64 39 | 40 | 41 | true 42 | full 43 | false 44 | bin\iPhone\Debug 45 | DEBUG 46 | prompt 47 | 4 48 | ARM64 49 | iPhone Developer 50 | true 51 | Entitlements.plist 52 | None 53 | -all 54 | 55 | 56 | none 57 | true 58 | bin\iPhone\Release 59 | prompt 60 | 4 61 | ARM64 62 | iPhone Developer 63 | Entitlements.plist 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | false 76 | 77 | 78 | false 79 | 80 | 81 | false 82 | 83 | 84 | false 85 | 86 | 87 | false 88 | 89 | 90 | false 91 | 92 | 93 | false 94 | 95 | 96 | false 97 | 98 | 99 | false 100 | 101 | 102 | false 103 | 104 | 105 | false 106 | 107 | 108 | false 109 | 110 | 111 | false 112 | 113 | 114 | false 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | {833852DE-5AA1-4A3B-AFB8-41E2DD88CBF0} 133 | Xamarin.Forms.NeoControls.Demo 134 | 135 | 136 | {c598b38b-4897-4d7e-96d1-abd59dd10753} 137 | Xamarin.Forms.NeoControls 138 | 139 | 140 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30717.126 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.NeoControls.Demo.Android", "Xamarin.Forms.NeoControls.Demo.Android\Xamarin.Forms.NeoControls.Demo.Android.csproj", "{CE821DF6-A93D-4013-9080-0FBE372C2E4F}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.NeoControls.Demo.iOS", "Xamarin.Forms.NeoControls.Demo.iOS\Xamarin.Forms.NeoControls.Demo.iOS.csproj", "{D5E35FEF-5799-4606-86D6-727ED6C0B22F}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Forms.NeoControls.Demo", "Xamarin.Forms.NeoControls.Demo\Xamarin.Forms.NeoControls.Demo.csproj", "{5D9F0280-C690-44D0-BB49-98103BE57C77}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Demo", "Demo", "{6E7DE2A5-FDC4-45BC-878E-AAB9C285C668}" 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{68C78F57-A248-4520-9B00-CC6D0E64B231}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Forms.NeoControls", "Xamarin.Forms.NeoControls\Xamarin.Forms.NeoControls.csproj", "{C598B38B-4897-4D7E-96D1-ABD59DD10753}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Any CPU = Debug|Any CPU 21 | Debug|iPhone = Debug|iPhone 22 | Debug|iPhoneSimulator = Debug|iPhoneSimulator 23 | Release|Any CPU = Release|Any CPU 24 | Release|iPhone = Release|iPhone 25 | Release|iPhoneSimulator = Release|iPhoneSimulator 26 | EndGlobalSection 27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 28 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 31 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Debug|iPhone.ActiveCfg = Debug|Any CPU 32 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Debug|iPhone.Build.0 = Debug|Any CPU 33 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Debug|iPhone.Deploy.0 = Debug|Any CPU 34 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 35 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 36 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU 37 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Release|Any CPU.Build.0 = Release|Any CPU 39 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Release|Any CPU.Deploy.0 = Release|Any CPU 40 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Release|iPhone.ActiveCfg = Release|Any CPU 41 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Release|iPhone.Build.0 = Release|Any CPU 42 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Release|iPhone.Deploy.0 = Release|Any CPU 43 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 44 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 45 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU 46 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Debug|Any CPU.ActiveCfg = Debug|iPhone 47 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Debug|Any CPU.Build.0 = Debug|iPhone 48 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Debug|Any CPU.Deploy.0 = Debug|iPhone 49 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Debug|iPhone.ActiveCfg = Debug|iPhone 50 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Debug|iPhone.Build.0 = Debug|iPhone 51 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Debug|iPhone.Deploy.0 = Debug|iPhone 52 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator 53 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator 54 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Debug|iPhoneSimulator.Deploy.0 = Debug|iPhoneSimulator 55 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator 56 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Release|Any CPU.Build.0 = Release|iPhoneSimulator 57 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Release|Any CPU.Deploy.0 = Release|iPhoneSimulator 58 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Release|iPhone.ActiveCfg = Release|iPhone 59 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Release|iPhone.Build.0 = Release|iPhone 60 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Release|iPhone.Deploy.0 = Release|iPhone 61 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator 62 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator 63 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F}.Release|iPhoneSimulator.Deploy.0 = Release|iPhoneSimulator 64 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 65 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Debug|Any CPU.Build.0 = Debug|Any CPU 66 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 67 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Debug|iPhone.ActiveCfg = Debug|Any CPU 68 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Debug|iPhone.Build.0 = Debug|Any CPU 69 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Debug|iPhone.Deploy.0 = Debug|Any CPU 70 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 71 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 72 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU 73 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Release|Any CPU.ActiveCfg = Release|Any CPU 74 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Release|Any CPU.Build.0 = Release|Any CPU 75 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Release|Any CPU.Deploy.0 = Release|Any CPU 76 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Release|iPhone.ActiveCfg = Release|Any CPU 77 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Release|iPhone.Build.0 = Release|Any CPU 78 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Release|iPhone.Deploy.0 = Release|Any CPU 79 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 80 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 81 | {5D9F0280-C690-44D0-BB49-98103BE57C77}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU 82 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 83 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Debug|Any CPU.Build.0 = Debug|Any CPU 84 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Debug|iPhone.ActiveCfg = Debug|Any CPU 85 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Debug|iPhone.Build.0 = Debug|Any CPU 86 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 87 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 88 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Release|Any CPU.ActiveCfg = Release|Any CPU 89 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Release|Any CPU.Build.0 = Release|Any CPU 90 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Release|iPhone.ActiveCfg = Release|Any CPU 91 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Release|iPhone.Build.0 = Release|Any CPU 92 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 93 | {C598B38B-4897-4D7E-96D1-ABD59DD10753}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 94 | EndGlobalSection 95 | GlobalSection(SolutionProperties) = preSolution 96 | HideSolutionNode = FALSE 97 | EndGlobalSection 98 | GlobalSection(NestedProjects) = preSolution 99 | {CE821DF6-A93D-4013-9080-0FBE372C2E4F} = {6E7DE2A5-FDC4-45BC-878E-AAB9C285C668} 100 | {D5E35FEF-5799-4606-86D6-727ED6C0B22F} = {6E7DE2A5-FDC4-45BC-878E-AAB9C285C668} 101 | {5D9F0280-C690-44D0-BB49-98103BE57C77} = {6E7DE2A5-FDC4-45BC-878E-AAB9C285C668} 102 | {C598B38B-4897-4D7E-96D1-ABD59DD10753} = {68C78F57-A248-4520-9B00-CC6D0E64B231} 103 | EndGlobalSection 104 | GlobalSection(ExtensibilityGlobals) = postSolution 105 | SolutionGuid = {AA09571F-286D-494A-8820-B52F7612779C} 106 | EndGlobalSection 107 | EndGlobal 108 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using Xamarin.Forms.Xaml; 4 | 5 | namespace Xamarin.Forms.NeoControls.Demo 6 | { 7 | public partial class App : Application 8 | { 9 | public App() 10 | { 11 | InitializeComponent(); 12 | 13 | MainPage = new MainPage(); 14 | } 15 | 16 | protected override void OnStart() 17 | { 18 | } 19 | 20 | protected override void OnSleep() 21 | { 22 | } 23 | 24 | protected override void OnResume() 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms.NeoControls; 2 | using Xamarin.Forms.Xaml; 3 | 4 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)] 5 | [assembly: PreserveNeoControls] -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 10 | 11 | 18 | 19 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Xamarin.Forms; 8 | 9 | namespace Xamarin.Forms.NeoControls.Demo 10 | { 11 | public partial class MainPage : ContentPage 12 | { 13 | public MainPage() 14 | { 15 | InitializeComponent(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.Demo/Xamarin.Forms.NeoControls.Demo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | true 6 | 7 | 8 | 9 | portable 10 | true 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30011.22 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Forms.NeoControls", "Xamarin.Forms.NeoControls\Xamarin.Forms.NeoControls.csproj", "{C54DCE3E-033C-42C3-99D0-08C01EAA7FEC}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{455EB4E9-07C3-4F10-8003-2B7B944B1C45}" 9 | ProjectSection(SolutionItems) = preProject 10 | .editorconfig = .editorconfig 11 | README.md = README.md 12 | EndProjectSection 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Github", "Github", "{C8C060A2-C4C2-4135-8F9A-E9DF156C299F}" 15 | EndProject 16 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{4BFEB2C0-B2AB-4F19-82A0-F07FAC8B6C79}" 17 | ProjectSection(SolutionItems) = preProject 18 | .github\workflows\PackageCI.yml = .github\workflows\PackageCI.yml 19 | .github\workflows\PrCheck.yml = .github\workflows\PrCheck.yml 20 | EndProjectSection 21 | EndProject 22 | Global 23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 24 | Debug|Any CPU = Debug|Any CPU 25 | Release|Any CPU = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 28 | {C54DCE3E-033C-42C3-99D0-08C01EAA7FEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {C54DCE3E-033C-42C3-99D0-08C01EAA7FEC}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {C54DCE3E-033C-42C3-99D0-08C01EAA7FEC}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {C54DCE3E-033C-42C3-99D0-08C01EAA7FEC}.Release|Any CPU.Build.0 = Release|Any CPU 32 | EndGlobalSection 33 | GlobalSection(SolutionProperties) = preSolution 34 | HideSolutionNode = FALSE 35 | EndGlobalSection 36 | GlobalSection(NestedProjects) = preSolution 37 | {4BFEB2C0-B2AB-4F19-82A0-F07FAC8B6C79} = {C8C060A2-C4C2-4135-8F9A-E9DF156C299F} 38 | EndGlobalSection 39 | GlobalSection(ExtensibilityGlobals) = postSolution 40 | SolutionGuid = {815CA7F1-18E6-4563-AB94-49CD509A63CB} 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Abstractions/IWithCanvasElement.cs: -------------------------------------------------------------------------------- 1 | namespace Xamarin.Forms.NeoControls 2 | { 3 | public interface IWithCanvasElement 4 | { 5 | void InvalidateCanvas(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Abstractions/IWithParentElement.cs: -------------------------------------------------------------------------------- 1 | namespace Xamarin.Forms.NeoControls 2 | { 3 | public interface IWithParentElement 4 | { 5 | BindableObject Parent { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Enums/ClickMode.cs: -------------------------------------------------------------------------------- 1 | namespace Xamarin.Forms.NeoControls 2 | { 3 | public enum ClickMode 4 | { 5 | SingleTap = 0, 6 | Toggle = 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Enums/DrawMode.cs: -------------------------------------------------------------------------------- 1 | namespace Xamarin.Forms.NeoControls 2 | { 3 | public enum DrawMode 4 | { 5 | Flat = 0, 6 | Soft = 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Enums/ShadowMode.cs: -------------------------------------------------------------------------------- 1 | namespace Xamarin.Forms.NeoControls 2 | { 3 | public enum ShadowDrawMode 4 | { 5 | OuterOnly = 0, 6 | InnerOnly = 1, 7 | All = 2, 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Extensions/ColorExtensions.cs: -------------------------------------------------------------------------------- 1 | using SkiaSharp; 2 | using SkiaSharp.Views.Forms; 3 | 4 | namespace Xamarin.Forms.NeoControls.Extensions 5 | { 6 | internal static class ColorExtensions 7 | { 8 | private const float DEFAULT_SIGMA = -6f; 9 | internal static SKImageFilter ToSKDropShadow(this Color shadowColor, float distance) 10 | { 11 | return SKImageFilter.CreateDropShadow( 12 | distance, 13 | distance, 14 | DEFAULT_SIGMA, 15 | DEFAULT_SIGMA, 16 | shadowColor.ToSKColor(), 17 | SKDropShadowImageFilterShadowMode.DrawShadowOnly); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Extensions/SkPathExtensions.cs: -------------------------------------------------------------------------------- 1 | using SkiaSharp; 2 | 3 | namespace Xamarin.Forms.NeoControls.Extensions 4 | { 5 | internal static class SkPathExtensions 6 | { 7 | private const int DEFAULT_XAXISROTATE = 0; 8 | 9 | internal static SKPath ArcTo(this SKPath path, float radius, SKPoint finalPoint) 10 | { 11 | path.ArcTo( 12 | new SKPoint(radius, radius), 13 | DEFAULT_XAXISROTATE, 14 | SKPathArcSize.Small, SKPathDirection.Clockwise, 15 | finalPoint); 16 | 17 | return path; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Extensions/TaskExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Xamarin.Forms.NeoControls.Extensions 5 | { 6 | /// 7 | /// Based on from Brandon Minnick 8 | /// 9 | internal static class TaskExtensions 10 | { 11 | internal static async void SafeFireAndForget(this Task task, bool continueOnCapturedContext = false, Action onException = null) 12 | { 13 | try 14 | { 15 | await task.ConfigureAwait(continueOnCapturedContext); 16 | } 17 | catch (Exception ex) when (onException != null) 18 | { 19 | onException.Invoke(ex); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Gradient.cs: -------------------------------------------------------------------------------- 1 | using SkiaSharp; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Xamarin.Forms.NeoControls 6 | { 7 | [ContentProperty(nameof(Stops))] 8 | public abstract class Gradient : BindableObject 9 | { 10 | #region Fields 11 | 12 | private GradientElements _stops; 13 | 14 | #endregion 15 | 16 | #region Bindable Properties 17 | 18 | public static readonly BindableProperty IsRepeatingProperty = BindableProperty.Create( 19 | propertyName: nameof(IsRepeating), 20 | returnType: typeof(bool), 21 | declaringType: typeof(Gradient), 22 | defaultValue: false); 23 | 24 | #endregion 25 | 26 | #region Properties 27 | 28 | public GradientElements Stops 29 | { 30 | get => _stops; 31 | set 32 | { 33 | _stops?.Release(); 34 | _stops = value; 35 | _stops.AttachTo(this); 36 | } 37 | } 38 | 39 | public bool IsRepeating 40 | { 41 | get => (bool)GetValue(IsRepeatingProperty); 42 | set => SetValue(IsRepeatingProperty, value); 43 | } 44 | 45 | #endregion 46 | 47 | #region Constructors 48 | 49 | protected Gradient() => 50 | Stops = new GradientElements(); 51 | 52 | #endregion 53 | 54 | #region Public Methods 55 | 56 | public IEnumerable GetGradients() => new[] { this }; 57 | 58 | public abstract SKShader BuildShader(RenderContext context); 59 | 60 | public virtual void Measure(int width, int height) 61 | { 62 | var fromIndex = 0; 63 | 64 | for (var i = 0; i < Stops.Count; i++) 65 | { 66 | if (Stops[i].Offset >= 0 || i == Stops.Count - 1) 67 | { 68 | SetupUndefinedOffsets(fromIndex, i); 69 | fromIndex = i; 70 | } 71 | } 72 | } 73 | 74 | #endregion 75 | 76 | #region Override Methods 77 | 78 | protected override void OnBindingContextChanged() 79 | { 80 | base.OnBindingContextChanged(); 81 | Stops.SetInheritedBindingContext(BindingContext); 82 | } 83 | 84 | #endregion 85 | 86 | #region Private Methods 87 | 88 | private void SetupUndefinedOffsets(int fromIndex, int toIndex) 89 | { 90 | var currentOffset = Math.Max(Stops[fromIndex].Offset, 0); 91 | var endOffset = Math.Abs(Stops[toIndex].Offset); 92 | 93 | var step = (endOffset - currentOffset) / (toIndex - fromIndex); 94 | 95 | for (var i = fromIndex; i <= toIndex; i++) 96 | { 97 | var stop = Stops[i]; 98 | 99 | if (stop.Offset < 0) 100 | { 101 | stop.RenderOffset = currentOffset; 102 | } 103 | currentOffset += step; 104 | } 105 | } 106 | 107 | #endregion 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/GradientElements.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Collections.Specialized; 5 | 6 | namespace Xamarin.Forms.NeoControls 7 | { 8 | public class GradientElements : ObservableCollection 9 | where TElement : BindableObject, IWithParentElement, IWithCanvasElement 10 | { 11 | #region Properties 12 | 13 | public BindableObject Parent { get; private set; } 14 | 15 | #endregion 16 | 17 | #region Constructors 18 | 19 | public GradientElements() { } 20 | 21 | public GradientElements(IEnumerable collection) : base(collection) { } 22 | 23 | public GradientElements(List list) : base(list) { } 24 | 25 | #endregion 26 | 27 | #region Internal Methods 28 | 29 | internal void AttachTo(BindableObject parent) 30 | { 31 | Parent = parent; 32 | 33 | foreach (var item in Items) 34 | { 35 | BindableObject.SetInheritedBindingContext(item, Parent?.BindingContext); 36 | item.Parent = parent; 37 | } 38 | 39 | InvalidateParentCanvas(); 40 | } 41 | 42 | internal void Release() 43 | { 44 | Parent = null; 45 | 46 | foreach (var item in Items) 47 | { 48 | BindableObject.SetInheritedBindingContext(item, null); 49 | item.Parent = null; 50 | } 51 | } 52 | 53 | internal void SetInheritedBindingContext(object bindingContext) 54 | { 55 | foreach (var item in Items) 56 | { 57 | BindableObject.SetInheritedBindingContext(item, bindingContext); 58 | } 59 | } 60 | 61 | #endregion 62 | 63 | #region Protected Methods 64 | 65 | protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) 66 | { 67 | base.OnCollectionChanged(e); 68 | 69 | if (Parent == null) 70 | return; 71 | 72 | var isChanged = false; 73 | 74 | if (e.OldItems != null) 75 | { 76 | SetupItems(e.OldItems, null); 77 | isChanged = true; 78 | } 79 | 80 | if (e.NewItems != null) 81 | { 82 | SetupItems(e.NewItems, Parent); 83 | isChanged = true; 84 | } 85 | 86 | if (isChanged) 87 | { 88 | InvalidateParentCanvas(); 89 | 90 | } 91 | } 92 | 93 | #endregion 94 | 95 | #region Private Methods 96 | 97 | private void SetupItems(IList items, BindableObject parent) 98 | { 99 | foreach (BindableObject item in items) 100 | { 101 | BindableObject.SetInheritedBindingContext(item, parent?.BindingContext); 102 | var element = (IWithParentElement)item; 103 | element.Parent = parent; 104 | } 105 | } 106 | 107 | private void InvalidateParentCanvas() 108 | { 109 | if (Parent is IWithCanvasElement parentWithCanvas) 110 | parentWithCanvas.InvalidateCanvas(); 111 | } 112 | 113 | #endregion 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/GradientStop.cs: -------------------------------------------------------------------------------- 1 | namespace Xamarin.Forms.NeoControls 2 | { 3 | public class GradientStop : BindableObject, IWithParentElement, IWithCanvasElement 4 | { 5 | #region Bindable Properties 6 | 7 | public static readonly BindableProperty ColorProperty = BindableProperty.Create( 8 | propertyName: nameof(Color), 9 | returnType: typeof(Color), 10 | declaringType: typeof(GradientStop), 11 | defaultValue: Color.White); 12 | 13 | public static readonly BindableProperty OffsetProperty = BindableProperty.Create( 14 | propertyName: nameof(Offset), 15 | returnType: typeof(float), 16 | declaringType: typeof(GradientStop), 17 | defaultValue: -1f, 18 | propertyChanged: OnOffsetChanged); 19 | 20 | #endregion 21 | 22 | #region Properties 23 | 24 | public BindableObject Parent { get; set; } 25 | 26 | public float RenderOffset { get; set; } = -1f; 27 | 28 | public Color Color 29 | { 30 | get => (Color)GetValue(ColorProperty); 31 | set => SetValue(ColorProperty, value); 32 | } 33 | 34 | public float Offset 35 | { 36 | get => (float)GetValue(OffsetProperty); 37 | set => SetValue(OffsetProperty, value); 38 | } 39 | 40 | #endregion 41 | 42 | #region IWithCanvasElement 43 | 44 | public void InvalidateCanvas() 45 | { 46 | if (Parent is IWithCanvasElement parentWithCanvas) 47 | parentWithCanvas?.InvalidateCanvas(); 48 | } 49 | 50 | #endregion 51 | 52 | #region Override Methods 53 | 54 | public override string ToString() 55 | { 56 | return $"Offset={Offset}, Color=[{Color}]"; 57 | } 58 | 59 | protected override void OnPropertyChanged(string propertyName = null) 60 | { 61 | InvalidateCanvas(); 62 | } 63 | 64 | #endregion 65 | 66 | #region Private Methods 67 | 68 | private static void OnOffsetChanged(BindableObject bindable, object oldvalue, object newvalue) 69 | { 70 | ((GradientStop)bindable).RenderOffset = (float)newvalue; 71 | } 72 | 73 | #endregion 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/LinearGradient.cs: -------------------------------------------------------------------------------- 1 | using SkiaSharp; 2 | using System; 3 | 4 | namespace Xamarin.Forms.NeoControls 5 | { 6 | public class LinearGradient : Gradient 7 | { 8 | #region Fields 9 | 10 | private readonly LinearGradientRenderer _renderer; 11 | 12 | #endregion 13 | 14 | #region Bindable Properties 15 | 16 | public static readonly BindableProperty AngleProperty = BindableProperty.Create( 17 | propertyName: nameof(Angle), 18 | returnType: typeof(double), 19 | declaringType: typeof(LinearGradient), 20 | defaultValue: 0d); 21 | 22 | #endregion 23 | 24 | #region Properties 25 | 26 | public double Angle 27 | { 28 | get => (double)GetValue(AngleProperty); 29 | set => SetValue(AngleProperty, value); 30 | } 31 | 32 | #endregion 33 | 34 | #region Constructors 35 | 36 | public LinearGradient() => 37 | _renderer = new LinearGradientRenderer(this); 38 | 39 | #endregion 40 | 41 | #region Override Methods 42 | 43 | public override void Measure(int width, int height) 44 | { 45 | base.Measure(width, height); 46 | 47 | foreach (var stop in Stops) 48 | { 49 | if (stop.RenderOffset > 1.001) 50 | stop.RenderOffset = GetOffsetFromPixels(stop.RenderOffset, width, height); 51 | } 52 | } 53 | 54 | public override SKShader BuildShader(RenderContext context) 55 | { 56 | #if DEBUG_RENDER 57 | System.Diagnostics.Debug.WriteLine($"Rendering Linear Gradient with {Stops.Count} stops"); 58 | #endif 59 | return _renderer.BuildShader(context); 60 | } 61 | 62 | #endregion 63 | 64 | #region Private Methods 65 | 66 | private float GetOffsetFromPixels(float offset, int width, int height) 67 | { 68 | var angleRad = (Math.PI / 180) * Angle; 69 | var computedLength = Math.Sqrt(Math.Pow(width * Math.Cos(angleRad), 2) 70 | + Math.Pow(height * Math.Sin(angleRad), 2)); 71 | 72 | return computedLength != 0 ? (float)(offset / computedLength) : 1; 73 | } 74 | 75 | #endregion 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/NeoButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using System.Windows.Input; 4 | using Xamarin.Forms.NeoControls.Extensions; 5 | 6 | namespace Xamarin.Forms.NeoControls 7 | { 8 | public class NeoButton : NeoRoundedView 9 | { 10 | private bool isPerformingTap; 11 | 12 | public static readonly BindableProperty CommandProperty = BindableProperty.Create( 13 | propertyName: nameof(Command), 14 | returnType: typeof(ICommand), 15 | declaringType: typeof(NeoButton), 16 | defaultValue: null); 17 | 18 | public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create( 19 | propertyName: nameof(CommandParameter), 20 | returnType: typeof(object), 21 | declaringType: typeof(NeoButton), 22 | defaultValue: null); 23 | 24 | public static readonly BindableProperty ClickModeProperty = BindableProperty.Create( 25 | propertyName: nameof(ClickMode), 26 | returnType: typeof(ClickMode), 27 | declaringType: typeof(NeoButton), 28 | defaultValue: ClickMode.SingleTap); 29 | 30 | public static readonly BindableProperty IsCheckedProperty = BindableProperty.Create( 31 | propertyName: nameof(IsChecked), 32 | returnType: typeof(bool), 33 | declaringType: typeof(NeoButton), 34 | defaultValue: false, 35 | propertyChanged: OnIsCheckedChanged); 36 | 37 | public ICommand Command 38 | { 39 | get => (ICommand)GetValue(CommandProperty); 40 | set => SetValue(CommandProperty, value); 41 | } 42 | 43 | public object CommandParameter 44 | { 45 | get => (object)GetValue(CommandParameterProperty); 46 | set => SetValue(CommandParameterProperty, value); 47 | } 48 | 49 | public ClickMode ClickMode 50 | { 51 | get => (ClickMode)GetValue(ClickModeProperty); 52 | set => SetValue(ClickModeProperty, value); 53 | } 54 | 55 | public bool IsChecked 56 | { 57 | get => (bool)GetValue(IsCheckedProperty); 58 | set => SetValue(IsCheckedProperty, value); 59 | } 60 | 61 | public event EventHandler Clicked; 62 | 63 | public NeoButton() 64 | { 65 | var tapGesture = new TapGestureRecognizer(); 66 | tapGesture.Tapped += OnButtonTapped; 67 | GestureRecognizers.Add(tapGesture); 68 | } 69 | 70 | public virtual Task AnimateClick(double toValue, uint length = 250, Easing easing = null) 71 | { 72 | double transform(double t) => (t * (toValue)); 73 | return PressAnimation(nameof(AnimateClick), transform, length, easing); 74 | } 75 | 76 | protected virtual async Task PerformButtonTappedAsync() 77 | { 78 | if (isPerformingTap || !IsEnabled) 79 | return; 80 | 81 | isPerformingTap = true; 82 | 83 | try 84 | { 85 | Clicked?.Invoke(this, EventArgs.Empty); 86 | 87 | if (Command?.CanExecute(CommandParameter) ?? false) 88 | Command.Execute(CommandParameter); 89 | 90 | if (ClickMode == ClickMode.Toggle) 91 | { 92 | IsChecked = !IsChecked; 93 | return; 94 | } 95 | 96 | await AnimateClick(ShadowDistance * -1); 97 | await AnimateClick(ShadowDistance * -1); 98 | } 99 | finally 100 | { 101 | isPerformingTap = false; 102 | } 103 | } 104 | 105 | protected override void DrawControl(RenderContext renderContext) 106 | { 107 | var drawPadding = ShadowDrawMode == ShadowDrawMode.InnerOnly ? 108 | 0 : Convert.ToSingle(ShadowBlur * 2); 109 | 110 | var diameter = drawPadding * 2; 111 | var retangleWidth = renderContext.Info.Width - diameter; 112 | var retangleHeight = renderContext.Info.Height - diameter; 113 | 114 | using (var path = CreatePath(retangleWidth, retangleHeight, drawPadding)) 115 | { 116 | renderContext.Paint.ImageFilter = null; 117 | if (DrawMode == DrawMode.Flat) 118 | renderContext.Paint.MaskFilter = null; 119 | 120 | renderContext.Canvas.DrawPath(path, renderContext.Paint); 121 | } 122 | } 123 | 124 | protected virtual Task PressAnimation(string name, Func transform, uint length, Easing easing) 125 | { 126 | var taskCompletionSource = new TaskCompletionSource(); 127 | (this).Animate( 128 | name, 129 | transform, 130 | (distance) => ShadowDistance = distance, 131 | 8, 132 | length, 133 | easing ?? Easing.Linear, 134 | (v, c) => taskCompletionSource.SetResult(c)); 135 | 136 | return taskCompletionSource.Task; 137 | } 138 | 139 | private void OnButtonTapped(object sender, EventArgs e) => 140 | PerformButtonTappedAsync().SafeFireAndForget(); 141 | 142 | private static void OnIsCheckedChanged(BindableObject bindable, object oldValue, object newValue) 143 | { 144 | if(bindable is NeoButton neoButton) 145 | PerformIsCheckedAnimationAsync(neoButton).SafeFireAndForget(); 146 | } 147 | 148 | private static async Task PerformIsCheckedAnimationAsync(NeoButton neoButton) => 149 | await neoButton.AnimateClick(neoButton.ShadowDistance * -1); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/NeoFrame.cs: -------------------------------------------------------------------------------- 1 | using SkiaSharp; 2 | using SkiaSharp.Views.Forms; 3 | using System; 4 | 5 | namespace Xamarin.Forms.NeoControls 6 | { 7 | public class NeoFrame : NeoRoundedView 8 | { 9 | public static readonly BindableProperty BorderColorProperty = BindableProperty.Create( 10 | propertyName: nameof(BorderColor), 11 | returnType: typeof(Color), 12 | declaringType: typeof(NeoFrame), 13 | defaultValue: Color.Transparent); 14 | 15 | public static readonly BindableProperty BorderWidthProperty = BindableProperty.Create( 16 | propertyName: nameof(BorderWidth), 17 | returnType: typeof(double), 18 | declaringType: typeof(NeoView), 19 | defaultValue: 1.0); 20 | 21 | public Color BorderColor 22 | { 23 | get => (Color)GetValue(BorderColorProperty); 24 | set => SetValue(BorderColorProperty, value); 25 | } 26 | 27 | public double BorderWidth 28 | { 29 | get => (double)GetValue(BorderWidthProperty); 30 | set => SetValue(BorderWidthProperty, value); 31 | } 32 | 33 | protected override void DrawControl(RenderContext renderContext) 34 | { 35 | var drawPadding = ShadowDrawMode == ShadowDrawMode.InnerOnly ? 36 | 0 : Convert.ToSingle(ShadowBlur * 2); 37 | 38 | var diameter = drawPadding * 2; 39 | var retangleWidth = renderContext.Info.Width - diameter; 40 | var retangleHeight = renderContext.Info.Height - diameter; 41 | 42 | using (var path = CreatePath(retangleWidth, retangleHeight, drawPadding)) 43 | { 44 | renderContext.Paint.ImageFilter = null; 45 | if (DrawMode == DrawMode.Flat) 46 | renderContext.Paint.MaskFilter = null; 47 | 48 | renderContext.Canvas.DrawPath(path, renderContext.Paint); 49 | 50 | if (BorderColor != Color.Transparent) 51 | DrawBorder(renderContext, path); 52 | } 53 | } 54 | 55 | protected virtual void DrawBorder(RenderContext renderContext, SKPath path) 56 | { 57 | renderContext.Paint.Style = SKPaintStyle.Stroke; 58 | renderContext.Paint.Color = BorderColor.ToSKColor(); 59 | renderContext.Paint.StrokeWidth = Convert.ToSingle(BorderWidth); 60 | renderContext.Canvas.DrawPath(path, renderContext.Paint); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/NeoProgressView.cs: -------------------------------------------------------------------------------- 1 | using SkiaSharp; 2 | using SkiaSharp.Views.Forms; 3 | using System; 4 | using System.Threading.Tasks; 5 | using Xamarin.Forms.NeoControls.Extensions; 6 | 7 | namespace Xamarin.Forms.NeoControls 8 | { 9 | public class NeoProgressView : NeoView 10 | { 11 | public static readonly BindableProperty BarColorProperty = BindableProperty.Create( 12 | propertyName: nameof(BarColor), 13 | returnType: typeof(Color), 14 | declaringType: typeof(NeoProgressView), 15 | defaultValue: Color.Red, 16 | propertyChanged: OnVisualPropertyChanged); 17 | 18 | public static readonly BindableProperty ProgressProperty = BindableProperty.Create( 19 | propertyName: nameof(Progress), 20 | returnType: typeof(double), 21 | declaringType: typeof(NeoProgressView), 22 | defaultValue: .4, 23 | propertyChanging: OnProgressChanging, 24 | propertyChanged: OnVisualPropertyChanged); 25 | 26 | public static readonly BindableProperty ThicknessProperty = BindableProperty.Create( 27 | propertyName: nameof(Thickness), 28 | returnType: typeof(double), 29 | declaringType: typeof(NeoProgressView), 30 | defaultValue: 5.0, 31 | propertyChanged: OnVisualPropertyChanged); 32 | 33 | public double Progress 34 | { 35 | get => (double)GetValue(ProgressProperty); 36 | set => SetValue(ProgressProperty, value); 37 | } 38 | 39 | public double Thickness 40 | { 41 | get => (double)GetValue(ThicknessProperty); 42 | set => SetValue(ThicknessProperty, value); 43 | } 44 | 45 | public Color BarColor 46 | { 47 | get => (Color)GetValue(BarColorProperty); 48 | set => SetValue(BarColorProperty, value); 49 | } 50 | 51 | public virtual Task AnimateProgress(float toValue, uint length = 250, Easing easing = null) 52 | { 53 | EnsureProgressRange(toValue); 54 | 55 | float transform(double t) => (float)(t * (toValue)); 56 | return ProgressAnimation(nameof(AnimateProgress), transform, length, easing); 57 | } 58 | 59 | protected override void PreDraw(RenderContext renderContext) 60 | { 61 | var fShadowBlur = Convert.ToSingle(ShadowBlur); 62 | var padding = fShadowBlur * 3f; 63 | var diameter = padding * 2; 64 | var retangleWidth = renderContext.Info.Width - diameter; 65 | var retangleHeight = renderContext.Info.Height - diameter; 66 | var cornerRadius = retangleHeight / 2; 67 | 68 | using (var barPath = CreateBarPath(padding, retangleWidth, retangleHeight, cornerRadius)) 69 | { 70 | renderContext.Paint.Color = BarColor.ToSKColor(); 71 | renderContext.Canvas.DrawPath(barPath, renderContext.Paint); 72 | } 73 | } 74 | 75 | protected override void DrawControl(RenderContext renderContext) 76 | { 77 | var fShadowBlur = Convert.ToSingle(ShadowBlur); 78 | var padding = fShadowBlur * 3f; 79 | var diameter = padding * 2; 80 | var retangleWidth = renderContext.Info.Width - diameter; 81 | var retangleHeight = renderContext.Info.Height - diameter; 82 | 83 | using (var path = CreatePath(retangleWidth, retangleHeight, padding)) 84 | { 85 | renderContext.Paint.ImageFilter = null; 86 | renderContext.Paint.Style = SKPaintStyle.Stroke; 87 | if (DrawMode == DrawMode.Flat) 88 | renderContext.Paint.MaskFilter = null; 89 | 90 | renderContext.Canvas.DrawPath(path, renderContext.Paint); 91 | } 92 | } 93 | 94 | protected override SKPath CreatePath( float retangleWidth, float retangleHeight, float padding) 95 | { 96 | var cornerRadius = retangleHeight / 2; 97 | var path = new SKPath(); 98 | path.MoveTo(cornerRadius + padding, padding); 99 | 100 | path.LineTo(retangleWidth - cornerRadius + padding, padding); 101 | path.ArcTo(cornerRadius, 102 | new SKPoint(retangleWidth - cornerRadius + padding, retangleHeight + padding)); 103 | 104 | path.LineTo(cornerRadius + padding, retangleHeight + padding); 105 | path.ArcTo(cornerRadius, new SKPoint(cornerRadius + padding, padding)); 106 | 107 | path.Close(); 108 | return path; 109 | } 110 | 111 | protected override void DrawInnerShadow(RenderContext renderContext) 112 | { 113 | //todo 114 | } 115 | 116 | protected override void DrawOuterShadow(RenderContext renderContext) 117 | { 118 | var fShadowBlur = Convert.ToSingle(ShadowBlur); 119 | var padding = fShadowBlur * 3f; 120 | var diameter = padding * 2; 121 | var retangleWidth = renderContext.Info.Width - diameter; 122 | var retangleHeight = renderContext.Info.Height - diameter; 123 | 124 | using (var path = CreatePath(retangleWidth, retangleHeight, padding)) 125 | { 126 | SetPaintColor(renderContext); 127 | 128 | renderContext.Paint.Style = SKPaintStyle.Stroke; 129 | renderContext.Paint.StrokeWidth = Convert.ToSingle(Thickness); 130 | renderContext.Paint.MaskFilter = SKMaskFilter.CreateBlur(SKBlurStyle.Normal, fShadowBlur); 131 | 132 | var shadow = Color.FromRgba(DarkShadowColor.R, DarkShadowColor.G, DarkShadowColor.B, Elevation); 133 | var fShadowDistance = Convert.ToSingle(ShadowDistance); 134 | 135 | renderContext.Paint.ImageFilter = shadow.ToSKDropShadow(fShadowDistance); 136 | renderContext.Canvas.DrawPath(path, renderContext.Paint); 137 | 138 | renderContext.Paint.ImageFilter = LightShadowColor.ToSKDropShadow(-fShadowDistance); 139 | renderContext.Canvas.DrawPath(path, renderContext.Paint); 140 | } 141 | } 142 | 143 | protected virtual SKPath CreateBarPath(float padding, float retangleWidth, float retangleHeight, float cornerRadius) 144 | { 145 | var fProgress = Convert.ToSingle(Progress); 146 | var invertedProgress = fProgress <= 0.5f ? 0 : 2 - (1 - ((1 - fProgress) / 0.5f)); 147 | var minProgress = Math.Max(0.01f, fProgress); 148 | var barPath = new SKPath(); 149 | 150 | barPath.MoveTo(cornerRadius + padding, padding); 151 | barPath.LineTo(((retangleWidth - cornerRadius) * minProgress) + padding, padding); 152 | 153 | barPath.ArcTo(cornerRadius * invertedProgress, 154 | new SKPoint(((retangleWidth - cornerRadius) * minProgress) + padding, retangleHeight + padding)); 155 | 156 | barPath.LineTo(cornerRadius + padding, retangleHeight + padding); 157 | barPath.ArcTo(cornerRadius, new SKPoint(cornerRadius + padding, padding)); 158 | 159 | barPath.Close(); 160 | 161 | return barPath; 162 | } 163 | 164 | protected virtual Task ProgressAnimation(string name, Func transform, uint length, Easing easing) 165 | { 166 | var taskCompletionSource = new TaskCompletionSource(); 167 | (this).Animate( 168 | name, 169 | transform, 170 | (progress) => Progress = progress, 171 | 8, 172 | length, 173 | easing ?? Easing.Linear, 174 | (v, c) => taskCompletionSource.SetResult(c)); 175 | 176 | return taskCompletionSource.Task; 177 | } 178 | 179 | private static void EnsureProgressRange(float progress) 180 | { 181 | if (progress > 1f || progress < 0) 182 | throw new ArgumentOutOfRangeException($"{nameof(progress)} should be between 0 and 1"); 183 | } 184 | 185 | private static void OnProgressChanging(BindableObject bindable, object oldValue, object newValue) 186 | { 187 | EnsureProgressRange(Convert.ToSingle(newValue)); 188 | } 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/NeoRoundedView.cs: -------------------------------------------------------------------------------- 1 | using SkiaSharp; 2 | using System; 3 | using System.Globalization; 4 | using Xamarin.Forms.NeoControls.Extensions; 5 | 6 | namespace Xamarin.Forms.NeoControls 7 | { 8 | public abstract class NeoRoundedView : NeoView 9 | { 10 | private const int DEFAULT_CORNER_RADIUS = 3; 11 | 12 | public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create( 13 | propertyName: nameof(CornerRadius), 14 | returnType: typeof(CornerRadius), 15 | declaringType: typeof(NeoRoundedView), 16 | defaultValue: new CornerRadius(DEFAULT_CORNER_RADIUS), 17 | propertyChanged: OnVisualPropertyChanged); 18 | 19 | public CornerRadius CornerRadius 20 | { 21 | get => (CornerRadius)GetValue(CornerRadiusProperty); 22 | set => SetValue(CornerRadiusProperty, value); 23 | } 24 | 25 | protected override SKPath CreatePath(float retangleWidth, float retangleHeight, float drawPadding) 26 | { 27 | var realWidth = Width > 0 ? Width : WidthRequest; 28 | var realHeight = Height > 0 ? Height : HeightRequest; 29 | 30 | var scaleX = retangleWidth / realWidth; 31 | var scaleY = retangleHeight / realHeight; 32 | 33 | var scale = Math.Min(scaleX, scaleY); 34 | 35 | var path = new SKPath(); 36 | var fTopLeftRadius = Convert.ToSingle(CornerRadius.TopLeft * scale, CultureInfo.InvariantCulture); 37 | var fTopRightRadius = Convert.ToSingle(CornerRadius.TopRight * scale, CultureInfo.InvariantCulture); 38 | var fBottomLeftRadius = Convert.ToSingle(CornerRadius.BottomLeft * scale, CultureInfo.InvariantCulture); 39 | var fBottomRightRadius = Convert.ToSingle(CornerRadius.BottomRight * scale, CultureInfo.InvariantCulture); 40 | 41 | var startX = fTopLeftRadius + drawPadding; 42 | var startY = drawPadding; 43 | 44 | path.MoveTo(startX, startY); 45 | 46 | path.LineTo(retangleWidth - fTopRightRadius + drawPadding, startY); 47 | path.ArcTo(fTopRightRadius, 48 | new SKPoint(retangleWidth + drawPadding, fTopRightRadius + drawPadding)); 49 | 50 | path.LineTo(retangleWidth + drawPadding, retangleHeight - fBottomRightRadius + drawPadding); 51 | path.ArcTo(fBottomRightRadius, 52 | new SKPoint(retangleWidth - fBottomRightRadius + drawPadding, retangleHeight + drawPadding)); 53 | 54 | path.LineTo(fBottomLeftRadius + drawPadding, retangleHeight + drawPadding); 55 | path.ArcTo(fBottomLeftRadius, 56 | new SKPoint(drawPadding, retangleHeight - fBottomLeftRadius + drawPadding)); 57 | 58 | path.LineTo(drawPadding, fTopLeftRadius + drawPadding); 59 | path.ArcTo(fTopLeftRadius, new SKPoint(startX, startY)); 60 | 61 | path.Close(); 62 | 63 | return path; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/NeoView.xaml: -------------------------------------------------------------------------------- 1 |  2 | 9 | 10 | 14 | 15 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/NeoView.xaml.cs: -------------------------------------------------------------------------------- 1 | using SkiaSharp; 2 | using SkiaSharp.Views.Forms; 3 | using System; 4 | using Xamarin.Forms.NeoControls.Extensions; 5 | 6 | namespace Xamarin.Forms.NeoControls 7 | { 8 | [ContentProperty(nameof(InnerView))] 9 | public abstract partial class NeoView : ContentView 10 | { 11 | public static readonly new BindableProperty BackgroundColorProperty = BindableProperty.Create( 12 | propertyName: nameof(ContentView.BackgroundColor), 13 | returnType: typeof(Color), 14 | declaringType: typeof(NeoView), 15 | defaultValue: Color.Transparent, 16 | propertyChanged: OnVisualPropertyChanged); 17 | 18 | public static readonly BindableProperty BackgroundGradientProperty = BindableProperty.Create( 19 | propertyName: nameof(BackgroundGradient), 20 | returnType: typeof(Gradient), 21 | declaringType: typeof(NeoView), 22 | defaultValue: null, 23 | propertyChanged: OnVisualPropertyChanged); 24 | 25 | public static readonly BindableProperty ShadowBlurProperty = BindableProperty.Create( 26 | propertyName: nameof(ShadowBlur), 27 | returnType: typeof(double), 28 | declaringType: typeof(NeoView), 29 | defaultValue: 10.0, 30 | propertyChanged: OnVisualPropertyChanged); 31 | 32 | public static readonly BindableProperty DrawModeProperty = BindableProperty.Create( 33 | propertyName: nameof(DrawMode), 34 | returnType: typeof(DrawMode), 35 | declaringType: typeof(NeoView), 36 | defaultValue: DrawMode.Flat, 37 | propertyChanged: OnVisualPropertyChanged); 38 | 39 | public static readonly BindableProperty ShadowDrawModeProperty = BindableProperty.Create( 40 | propertyName: nameof(NeoControls.ShadowDrawMode), 41 | returnType: typeof(ShadowDrawMode), 42 | declaringType: typeof(NeoView), 43 | defaultValue: ShadowDrawMode.OuterOnly, 44 | propertyChanged: OnVisualPropertyChanged); 45 | 46 | public static readonly BindableProperty ElevationProperty = BindableProperty.Create( 47 | propertyName: nameof(Elevation), 48 | returnType: typeof(double), 49 | declaringType: typeof(NeoView), 50 | defaultValue: .6, 51 | propertyChanged: OnVisualPropertyChanged); 52 | 53 | public static readonly BindableProperty ShadowDistanceProperty = BindableProperty.Create( 54 | propertyName: nameof(ShadowDistance), 55 | returnType: typeof(double), 56 | declaringType: typeof(NeoView), 57 | defaultValue: 9.0, 58 | propertyChanged: OnVisualPropertyChanged); 59 | 60 | public static readonly BindableProperty LightShadowColorProperty = BindableProperty.Create( 61 | propertyName: nameof(LightShadowColor), 62 | returnType: typeof(Color), 63 | declaringType: typeof(NeoView), 64 | defaultValue: Color.White, 65 | propertyChanged: OnVisualPropertyChanged); 66 | 67 | public static readonly BindableProperty DarkShadowColorProperty = BindableProperty.Create( 68 | propertyName: nameof(DarkShadowColor), 69 | returnType: typeof(Color), 70 | declaringType: typeof(NeoView), 71 | defaultValue: Color.Black, 72 | propertyChanged: OnVisualPropertyChanged); 73 | 74 | public static readonly BindableProperty InnerViewProperty = BindableProperty.Create( 75 | propertyName: nameof(InnerView), 76 | returnType: typeof(View), 77 | declaringType: typeof(NeoView), 78 | defaultValue: null, 79 | propertyChanged: OnInnerViewChanged); 80 | 81 | public new Color BackgroundColor 82 | { 83 | get => (Color)GetValue(BackgroundColorProperty); 84 | set => SetValue(BackgroundColorProperty, value); 85 | } 86 | 87 | public Gradient BackgroundGradient 88 | { 89 | get => (Gradient)GetValue(BackgroundGradientProperty); 90 | set => SetValue(BackgroundGradientProperty, value); 91 | } 92 | 93 | public double Elevation 94 | { 95 | get => (double)GetValue(ElevationProperty); 96 | set => SetValue(ElevationProperty, value); 97 | } 98 | 99 | public double ShadowDistance 100 | { 101 | get => (double)GetValue(ShadowDistanceProperty); 102 | set => SetValue(ShadowDistanceProperty, value); 103 | } 104 | 105 | public double ShadowBlur 106 | { 107 | get => (double)GetValue(ShadowBlurProperty); 108 | set => SetValue(ShadowBlurProperty, value); 109 | } 110 | 111 | public Color LightShadowColor 112 | { 113 | get => (Color)GetValue(LightShadowColorProperty); 114 | set => SetValue(LightShadowColorProperty, value); 115 | } 116 | 117 | public Color DarkShadowColor 118 | { 119 | get => (Color)GetValue(DarkShadowColorProperty); 120 | set => SetValue(DarkShadowColorProperty, value); 121 | } 122 | 123 | public View InnerView 124 | { 125 | get => (View)GetValue(InnerViewProperty); 126 | set => SetValue(InnerViewProperty, value); 127 | } 128 | 129 | public DrawMode DrawMode 130 | { 131 | get => (DrawMode)GetValue(DrawModeProperty); 132 | set => SetValue(DrawModeProperty, value); 133 | } 134 | 135 | public ShadowDrawMode ShadowDrawMode 136 | { 137 | get => (ShadowDrawMode)GetValue(ShadowDrawModeProperty); 138 | set => SetValue(ShadowDrawModeProperty, value); 139 | } 140 | 141 | public NeoView() => InitializeComponent(); 142 | 143 | protected virtual void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args) 144 | { 145 | var surface = args.Surface; 146 | var canvas = surface.Canvas; 147 | 148 | canvas.Clear(); 149 | using (var paint = new SKPaint()) 150 | { 151 | paint.IsAntialias = true; 152 | paint.Style = SKPaintStyle.Fill; 153 | 154 | var context = new RenderContext(canvas, paint, args.Info); 155 | SetPaintColor(context); 156 | 157 | var drawOuterShadow = ShadowDrawMode == ShadowDrawMode.All || ShadowDrawMode == ShadowDrawMode.OuterOnly; 158 | var drawInnerShadow = ShadowDrawMode == ShadowDrawMode.All || ShadowDrawMode == ShadowDrawMode.InnerOnly; 159 | 160 | PreDraw(context); 161 | 162 | if (drawOuterShadow) 163 | DrawOuterShadow(context); 164 | 165 | SetPaintColor(context); 166 | DrawControl(context); 167 | 168 | if (drawInnerShadow) 169 | DrawInnerShadow(context); 170 | } 171 | } 172 | 173 | protected virtual void SetPaintColor(RenderContext context) 174 | { 175 | if (BackgroundGradient != null) 176 | context.Paint.Shader = BackgroundGradient.BuildShader(context); 177 | else 178 | context.Paint.Color = BackgroundColor.ToSKColor(); 179 | } 180 | 181 | protected virtual void PreDraw(RenderContext context) 182 | { 183 | } 184 | 185 | protected virtual void DrawInnerShadow(RenderContext context) 186 | { 187 | var fShadowDistance = Convert.ToSingle(ShadowDistance); 188 | var darkShadow = Color.FromRgba(DarkShadowColor.R, DarkShadowColor.G, DarkShadowColor.B, Elevation); 189 | var drawPadding = ShadowDrawMode == ShadowDrawMode.InnerOnly ? 190 | 0 : Convert.ToSingle(ShadowBlur * 2); 191 | 192 | var diameter = drawPadding * 2; 193 | var retangleWidth = context.Info.Width - diameter; 194 | var retangleHeight = context.Info.Height - diameter; 195 | 196 | using (var path = CreatePath(retangleWidth, retangleHeight, drawPadding)) 197 | { 198 | context.Paint.MaskFilter = SKMaskFilter.CreateBlur(SKBlurStyle.Normal, Convert.ToSingle(ShadowBlur)); 199 | 200 | context.Canvas.ClipPath(path); 201 | context.Paint.Style = SKPaintStyle.Stroke; 202 | context.Paint.StrokeWidth = fShadowDistance; 203 | 204 | context.Paint.ImageFilter = LightShadowColor.ToSKDropShadow(-fShadowDistance); 205 | context.Canvas.DrawPath(path, context.Paint); 206 | 207 | context.Paint.ImageFilter = darkShadow.ToSKDropShadow(fShadowDistance); 208 | context.Canvas.DrawPath(path, context.Paint); 209 | } 210 | } 211 | 212 | protected virtual void DrawOuterShadow(RenderContext context) 213 | { 214 | var fShadowDistance = Convert.ToSingle(ShadowDistance); 215 | var darkShadow = Color.FromRgba(DarkShadowColor.R, DarkShadowColor.G, DarkShadowColor.B, Elevation); 216 | var drawPadding = Convert.ToSingle(ShadowBlur * 2); 217 | 218 | context.Paint.MaskFilter = SKMaskFilter.CreateBlur(SKBlurStyle.Normal, Convert.ToSingle(ShadowBlur)); 219 | 220 | var diameter = drawPadding * 2; 221 | var retangleWidth = context.Info.Width - diameter; 222 | var retangleHeight = context.Info.Height - diameter; 223 | 224 | using (var path = CreatePath(retangleWidth, retangleHeight, drawPadding)) 225 | { 226 | context.Paint.ImageFilter = darkShadow.ToSKDropShadow(fShadowDistance); 227 | context.Canvas.DrawPath(path, context.Paint); 228 | 229 | context.Paint.ImageFilter = LightShadowColor.ToSKDropShadow(-fShadowDistance); 230 | context.Canvas.DrawPath(path, context.Paint); 231 | } 232 | } 233 | 234 | protected abstract void DrawControl(RenderContext context); 235 | 236 | protected abstract SKPath CreatePath(float retangleWidth, float retangleHeight, float drawPadding); 237 | 238 | protected static void OnVisualPropertyChanged(BindableObject bindable, object oldValue, object newValue) => 239 | ((NeoView)bindable).canvas.InvalidateSurface(); 240 | 241 | private static void OnInnerViewChanged(BindableObject bindable, object oldValue, object newValue) 242 | { 243 | if (bindable is NeoView neoView) 244 | { 245 | if (newValue is View child) 246 | neoView.rootView.Children.Add(child, 0, 0); 247 | } 248 | } 249 | } 250 | } -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | using Xamarin.Forms.Internals; 3 | using Xamarin.Forms.Xaml; 4 | 5 | //Linker safe 6 | [assembly: Preserve(AllMembers = true)] 7 | 8 | //Custom xaml schema 9 | [assembly: XmlnsDefinition("http://xamarin.com/schemas/2014/forms", "Xamarin.Forms.NeoControls")] 10 | 11 | //Recommended prefix 12 | [assembly: XmlnsPrefix("http://neocontrols.com/schemas/xaml", "neo")] 13 | 14 | //Xaml compilation 15 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)] -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Properties/PreserveNeoControlsAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace Xamarin.Forms.NeoControls 5 | { 6 | [EditorBrowsable(EditorBrowsableState.Never)] 7 | [AttributeUsage(AttributeTargets.Assembly)] 8 | public sealed class PreserveNeoControlsAttribute : Attribute 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Renderers/LinearGradientRenderer.cs: -------------------------------------------------------------------------------- 1 | using SkiaSharp; 2 | using SkiaSharp.Views.Forms; 3 | using System; 4 | using System.Linq; 5 | 6 | namespace Xamarin.Forms.NeoControls 7 | { 8 | public class LinearGradientRenderer 9 | { 10 | private readonly LinearGradient _gradient; 11 | 12 | public LinearGradientRenderer(LinearGradient gradient) => 13 | _gradient = gradient; 14 | 15 | public SKShader BuildShader(RenderContext context) 16 | { 17 | var info = context.Info; 18 | 19 | var orderedStops = _gradient.Stops.OrderBy(x => x.RenderOffset).ToArray(); 20 | var lastOffset = orderedStops.LastOrDefault()?.RenderOffset ?? 1; 21 | 22 | var colors = orderedStops.Select(x => x.Color.ToSKColor()).ToArray(); 23 | var colorPos = orderedStops.Select(x => x.RenderOffset / lastOffset).ToArray(); 24 | 25 | var (startPoint, endPoint) = GetGradientPoints(info.Width, info.Height, _gradient.Angle, lastOffset); 26 | 27 | return SKShader.CreateLinearGradient( 28 | startPoint, 29 | endPoint, 30 | colors, 31 | colorPos, 32 | _gradient.IsRepeating ? SKShaderTileMode.Repeat : SKShaderTileMode.Clamp); 33 | } 34 | 35 | private (SKPoint, SKPoint) GetGradientPoints(int width, int height, double rotation, float offset) 36 | { 37 | var angle = rotation / 360.0; 38 | 39 | var a = width * Math.Pow(Math.Sin(2 * Math.PI * ((angle + 0.75) / 2)), 2); 40 | var b = height * Math.Pow(Math.Sin(2 * Math.PI * ((angle + 0.0) / 2)), 2); 41 | var c = width * Math.Pow(Math.Sin(2 * Math.PI * ((angle + 0.25) / 2)), 2); 42 | var d = height * Math.Pow(Math.Sin(2 * Math.PI * ((angle + 0.5) / 2)), 2); 43 | 44 | var start = new SKPoint( 45 | (width - (float)a) * offset, 46 | (float)b * offset); 47 | 48 | var end = new SKPoint( 49 | (width - (float)c) * offset, 50 | (float)d * offset); 51 | 52 | return (start, end); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Renderers/RenderContext.cs: -------------------------------------------------------------------------------- 1 | using SkiaSharp; 2 | 3 | namespace Xamarin.Forms.NeoControls 4 | { 5 | public class RenderContext 6 | { 7 | public SKCanvas Canvas { get; } 8 | 9 | public SKPaint Paint { get; } 10 | 11 | public SKImageInfo Info { get; } 12 | 13 | public RenderContext(SKCanvas canvas, SKPaint paint, SKImageInfo info) 14 | { 15 | Canvas = canvas; 16 | Paint = paint; 17 | Info = info; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/Xamarin.Forms.NeoControls.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | true 6 | LICENSE 7 | https://github.com/felipebaltazar/Xamarin.Forms.NeoControls 8 | https://github.com/felipebaltazar/Xamarin.Forms.NeoControls 9 | neomorphism, xamarin, xamarin.forms, skia, neomorphic 10 | Neomorphic controls for Xamarin.Forms 11 | 1.1.1-pre 12 | 1.1.1.0 13 | 1.1.1.0 14 | Icon.png 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | MSBuild:UpdateDesignTimeXaml 25 | 26 | 27 | 28 | 29 | 30 | True 31 | 32 | 33 | 34 | True 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/build/PreserveNeoControls.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms.NeoControls; 2 | 3 | // This will intialize the XAML namespace in your project, without any ".Init()" call 4 | [assembly: PreserveNeoControls] 5 | -------------------------------------------------------------------------------- /Xamarin.Forms.NeoControls/build/Xamarin.Forms.NeoControls.targets: -------------------------------------------------------------------------------- 1 |  2 | 3 | 5 | 6 | 7 | --------------------------------------------------------------------------------