├── .gitattributes ├── .github └── pull_request_template.md ├── .gitignore ├── .openpublishing.publish.config.json ├── CONTRIBUTING.md ├── LICENSE ├── LICENSE-CODE ├── README.md ├── SECURITY.md ├── ThirdPartyNotices.md ├── contributing-guidelines ├── images │ ├── alerts.png │ └── responsivedesign.gif ├── template.md └── voice-tone.md └── docs ├── .template.md ├── TOC.yml ├── behaviors ├── animationbehavior.md ├── animationtypes.md ├── charactersvalidationbehavior.md ├── emailvalidationbehavior.md ├── eventtocommandbehavior.md ├── impliedordergridbehavior-images │ └── ImpliedOrderGridBehavior.png ├── impliedordergridbehavior.md ├── maskedbehavior.md ├── maxlengthreachedbehavior.md ├── multivalidationbehavior.md ├── numericvalidationbehavior.md ├── requiredstringvalidationbehavior.md ├── setfocusonentrycompletedbehavior.md ├── textvalidationbehavior.md ├── urivalidationbehavior.md ├── userstoppedtypingbehavior.md └── validationbehavior.md ├── breadcrumb └── toc.yml ├── converters ├── booltoobjectconverter.md ├── bytearraytoimagesourceconverter.md ├── compareconverter.md ├── datetimeoffsetconverter.md ├── doubletointconverter.md ├── enumtoboolconverter.md ├── enumtointconverter.md ├── equalconverter.md ├── indextoarrayitemconverter.md ├── inttoboolconverter.md ├── invertedboolconverter.md ├── isinrangeconverter.md ├── isnotnulloremptyconverter.md ├── isnulloremptyconverter.md ├── itemselectedeventargsconverter.md ├── itemtappedeventargsconverter.md ├── listisnotnulloremptyconverter.md ├── listisnulloremptyconverter.md ├── listtostringconverter.md ├── mathexpressionconverter.md ├── multiconverter.md ├── notequalconverter.md ├── stringtolistconverter.md ├── textcaseconverter.md └── variablemultivalueconverter.md ├── docfx.json ├── effects ├── lifecycleeffect.md └── safeareaeffect.md ├── extensions ├── imageresourceextension.md └── translateextension.md ├── get-started.md ├── helpers ├── delegateweakeventmanager.md ├── localizationresourcemanager.md ├── localizedstring.md ├── weakeventmanagerextensions.md └── weakeventmanagert.md ├── images ├── download.png ├── managenuget.png ├── pre-release.png └── preview.png ├── index.md ├── markup.md ├── objectmodel ├── asynccommand.md ├── asyncvaluecommand.md └── commandfactory.md ├── troubleshooting.md └── views ├── avatarview.md ├── badgeview.md ├── cameraview.md ├── docklayout.md ├── expander-images ├── embedded-expander1.png ├── embedded-expander2.png ├── expander.png ├── icon-collapse.png └── icon-expand.png ├── expander.md ├── lazyview.md ├── mediaelement-images ├── custom-position-bar-large.png ├── custom-position-bar.png ├── custom-transport-paused-large.png ├── custom-transport-paused.png ├── custom-transport-playback-large.png ├── custom-transport-playback.png ├── playback-controls-large.png └── playback-controls.png ├── mediaelement.md ├── popup-images ├── custom-positioning-popup.png └── simple-popup.png ├── popup.md ├── rangeslider.md ├── shield-images └── example-shields.png ├── shield.md ├── statelayout.md ├── tabview.md ├── uniformgrid-images ├── uniformgrid-example-large.png └── uniformgrid-example.png └── uniformgrid.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # Explicitly declare text files you want to always be normalized and converted 5 | # to native line endings on checkout. 6 | *.c text 7 | *.h text 8 | 9 | # Declare files that will always have CRLF line endings on checkout. 10 | *.sln text eol=crlf 11 | 12 | # Denote all files that are truly binary and should not be modified. 13 | *.png binary 14 | *.jpg binary -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Fixes # 2 | 3 | ## Docs for Toolkit PR [#](https://github.com/xamarin/XamarinCommunityToolkit/pull/#) 4 | 5 | ## What changes to the docs does this PR provide? 6 | 7 | 8 | 9 | ## PR Checklist 10 | 11 | Please check if your PR fulfills the following requirements: 12 | 13 | - [ ] For new pages, used the [provided template](https://github.com/MicrosoftDocs/xamarin-communitytoolkit/blob/master/docs/.template.md). 14 | - [ ] For new features, added an entry in the [Table of Contents](https://github.com/MicrosoftDocs/xamarin-communitytoolkit/blob/master/docs/TOC.yml). 15 | - [ ] Ran against a spell and grammar checker. 16 | - [ ] Contains **NO** breaking changes. 17 | 18 | 19 | 20 | ## Other information 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | log/ 2 | obj/ 3 | _site/ 4 | .optemp/ 5 | _themes*/ 6 | _repo.*/ 7 | 8 | .openpublishing.buildcore.ps1 9 | .DS_Store 10 | /.vs 11 | .vscode/settings.json 12 | 13 | docs/xamarin-communitytoolkit -------------------------------------------------------------------------------- /.openpublishing.publish.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "docsets_to_publish": [ 3 | { 4 | "docset_name": "xamarin-communitytoolkit", 5 | "build_source_folder": "docs", 6 | "build_output_subfolder": "xamarin-communitytoolkit", 7 | "locale": "en-us", 8 | "monikers": [], 9 | "moniker_ranges": [], 10 | "xref_query_tags": [ 11 | "/dotnet", 12 | "/uwp/api" 13 | ], 14 | "open_to_public_contributors": false, 15 | "type_mapping": { 16 | "Conceptual": "Content" 17 | }, 18 | "build_entry_point": "docs", 19 | "template_folder": "_themes" 20 | } 21 | ], 22 | "notification_subscribers": [ 23 | "dabritch@microsoft.com" 24 | ], 25 | "sync_notification_subscribers": [], 26 | "branches_to_filter": [], 27 | "skip_source_output_uploading": false, 28 | "need_preview_pull_request": true, 29 | "contribution_branch_mappings": {}, 30 | "dependent_repositories": [ 31 | { 32 | "path_to_root": "_themes", 33 | "url": "https://github.com/Microsoft/templates.docs.msft", 34 | "branch": "main", 35 | "branch_mapping": {} 36 | }, 37 | { 38 | "path_to_root": "_themes.pdf", 39 | "url": "https://github.com/Microsoft/templates.docs.msft.pdf", 40 | "branch": "main", 41 | "branch_mapping": {} 42 | } 43 | ], 44 | "branch_target_mapping": { 45 | "live": [ 46 | "Publish", 47 | "Pdf" 48 | ] 49 | }, 50 | "need_generate_pdf_url_template": true, 51 | "targets": { 52 | "pdf": { 53 | "template_folder": "_themes.pdf" 54 | } 55 | }, 56 | "docs_build_engine": { 57 | "name": "docfx_v3" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribute to the Xamarin community toolkit documentation 2 | 3 | Thank you for your interest in contributing to the Xamarin community toolkit documentation. 4 | 5 | Documentation is **required** when adding, removing, or updating an element or an API in the Xamarin community toolkit. To update the documentation, you must submit a separate pull request in this repository as well (use the *master* branch). 6 | 7 | When adding a new documentation page: 8 | 9 | - Copy the [documentation template](https://github.com/MicrosoftDocs/xamarin-communitytoolkit/blob/master/docs/.template.md) and follow the same format. 10 | - Write your content. Refer to the [template](contributing-guidelines/template.md) and [style guide](contributing-guidelines/voice-tone.md). 11 | - Update the [Table of Contents](https://github.com/MicrosoftDocs/xamarin-communitytoolkit/blob/master/docs/TOC.yml) to point to the new page. 12 | 13 | For information about contributing to the Xamarin community toolkit source code, see [Contribution guidelines](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/CONTRIBUTING.md). 14 | -------------------------------------------------------------------------------- /LICENSE-CODE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) Microsoft Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, 6 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to the Xamarin Community Toolkit Documentation 2 | 3 | The Xamarin community toolkit is a collection of reusable elements for mobile development with Xamarin.Forms, including animations, behaviors, converters, effects, and helpers. It simplifies and demonstrates common developer tasks when building iOS, Android, and Universal Windows Platform (UWP) apps using Xamarin.Forms. 4 | 5 | Support for Xamarin ended on the 1st May 2024 and so this documentation won't be updated. For more information, see [Xamarin Support Policy](https://dotnet.microsoft.com/platform/support/policy/xamarin). 6 | 7 | ## Contributing 8 | 9 | Do you want to contribute or update the docs? Read the [contribution guidelines](CONTRIBUTING.md). 10 | 11 | When opening a PR, start by forking this repository. Then, you'll need to create a new branch from the `master` branch. 12 | 13 | We will periodically merge updates from the live branch to master to keep master in-sync with the published docs. When we make a new release, we will push master to the live branch in order to publish documentation for new features. 14 | 15 | ## Documentation Links 16 | 17 | - [Staging review from 'master' branch](https://review.learn.microsoft.com/xamarin/community-toolkit/?branch=main) - *this link is currently only available for Microsoft employees.* 18 | - [Live site from 'live' branch](https://learn.microsoft.com/previous-versions/xamarin/community-toolkit/) 19 | 20 | ## Microsoft Open Source Code of Conduct 21 | 22 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 23 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /ThirdPartyNotices.md: -------------------------------------------------------------------------------- 1 | ## Legal Notices 2 | Microsoft and any contributors grant you a license to the Microsoft documentation and other content 3 | in this repository under the [Creative Commons Attribution 4.0 International Public License](https://creativecommons.org/licenses/by/4.0/legalcode), 4 | see the [LICENSE](LICENSE) file, and grant you a license to any code in the repository under the [MIT License](https://opensource.org/licenses/MIT), see the 5 | [LICENSE-CODE](LICENSE-CODE) file. 6 | 7 | Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation 8 | may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. 9 | The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. 10 | Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653. 11 | 12 | Privacy information can be found at https://privacy.microsoft.com/en-us/ 13 | 14 | Microsoft and any contributors reserve all others rights, whether under their respective copyrights, patents, 15 | or trademarks, whether by implication, estoppel or otherwise. -------------------------------------------------------------------------------- /contributing-guidelines/images/alerts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicrosoftDocs/xamarin-communitytoolkit/1a99b30aa67aa1ab98755ebd431280ffcf306e7d/contributing-guidelines/images/alerts.png -------------------------------------------------------------------------------- /contributing-guidelines/images/responsivedesign.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicrosoftDocs/xamarin-communitytoolkit/1a99b30aa67aa1ab98755ebd431280ffcf306e7d/contributing-guidelines/images/responsivedesign.gif -------------------------------------------------------------------------------- /contributing-guidelines/voice-tone.md: -------------------------------------------------------------------------------- 1 | # Voice and tone guidelines 2 | 3 | Developers will be reading your documents to learn about the Xamarin community toolkit, and to use it in their regular work. 4 | Your goal is to create useful documentation that helps the reader on their journey. Our guidelines 5 | help with that. Our style guide contains four recommendations: 6 | 7 | - [Use a Conversational Tone](#use-a-conversational-tone) 8 | - [Write in Second Person](#write-in-2nd-person) 9 | - [Use Active Voice](#use-active-voice) 10 | - [Target a 5th Grade Reading Level](#target-a-fifth-grade-reading-level) 11 | 12 | You will see examples of each of these as you read this style guide. We've written this guide 13 | following our guidelines to provide examples for you to follow as you build documentation 14 | for the Xamarin community toolkit. We also provide contrasting samples so you can see what articles look like 15 | when you don't follow our guidelines. 16 | 17 | ## Details on each guideline 18 | 19 | ### Use a Conversational Tone 20 | 21 | #### Appropriate Style 22 | 23 | We want our documentation to have a conversational tone. You should feel as though you 24 | are having a conversation with the author as you read any of our tutorials or explanations. 25 | Your experience as a reader should be informal, conversational, and informative. You should 26 | feel as though you are listening to the author explain the concepts to you. 27 | 28 | #### Inappropriate Style 29 | 30 | One might see the contrast between a conversational style and the style one finds with 31 | more academic treatments of technical topics. Those resources are very useful, but the authors 32 | have written those articles in a very different style than our documentation. When one reads 33 | an academic journal, one finds a very different tone and a very different style of writing. 34 | One feels that they are reading a dry account of a very dry topic. 35 | 36 | The first paragraph above follows our recommendation conversational style. The second 37 | is a more academic style. You see the difference immediately. 38 | 39 | ### Write in second person 40 | 41 | #### Appropriate Style 42 | 43 | You should write your articles as though you are speaking directly to the reader. You 44 | should use the second person often (as I just have in these two sentences). Writing in second person doesn't 45 | always mean using the word 'you'. Write directly to the reader. Write imperative sentences. 46 | Tell your reader what you want them to learn. 47 | 48 | #### Inappropriate Style 49 | 50 | An author could also choose to write in the third person. In that model, an author must find some 51 | pronoun or noun to use when referring to the reader. A reader might often find this third 52 | person style less engaging and less enjoyable to read. 53 | 54 | The first paragraph follows our recommended style. The second uses third person. Please write 55 | in second person. You probably found that much easier to read. 56 | 57 | ### Use Active Voice 58 | 59 | Write your articles in the active voice. Active voice means that the subject of the sentence performs 60 | the action (verb) of that sentence. It contrasts with passive voice, where the sentence is arranged 61 | such that the subject of the sentence is acted upon. Contrast these two examples: 62 | 63 | > The compiler transformed source code into an executable. 64 | 65 | > The source code was transformed into an executable by the compiler. 66 | 67 | The first sentence uses active voice. The second sentence was written in passive voice. 68 | (Those two sentences provide another example of each style). 69 | 70 | We recommend active voice because it is more readable. Passive voice can be more difficult to read. 71 | 72 | ### Target a Fifth Grade Reading Level 73 | 74 | We provide this final guideline because many of our readers are not native English speakers. 75 | You are reaching an international audience with your articles. Please take into account that 76 | they may not have the English vocabulary you have. 77 | 78 | However, you are still writing for technical professionals. You can assume that your readers 79 | have programming knowledge and the specific vocabulary for programming terms. Object-Oriented 80 | Programming, Class, and Object, Function and Method will all be familiar terms. However, not everyone 81 | reading your articles will have a formal computer science degree. Terms like 'idempotent' probably 82 | need to be defined if you use it: 83 | 84 | > The `Close()` method is idempotent, meaning that you can call it multiple times and the effect is 85 | the same as if you called it once. 86 | -------------------------------------------------------------------------------- /docs/.template.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Document title 3 | author: GitHub_UserName 4 | ms.author: joverslu 5 | description: Describe the element in one sentence. 6 | ms.date: 01/14/2021 7 | --- 8 | 9 | 10 | 11 | # Title 12 | 13 | 14 | 15 | 33 | 34 | ## Syntax 35 | 36 | ```xaml 37 | 38 | ``` 39 | 40 | ```csharp 41 | 42 | ``` 43 | 44 | ## Sample output 45 | 46 | 47 | 48 | ## Properties 49 | 50 | 51 | 52 | | Property | Type | Description | 53 | | -- | -- | -- | 54 | | A | bool | Description | 55 | | B | int | Description | 56 | 57 | ## Methods 58 | 59 | 60 | 61 | | Methods | Return Type | Description | 62 | | -- | -- | -- | 63 | | A(int) | bool | Description | 64 | | B(float, string) | int | Description | 65 | 66 | ## Events 67 | 68 | 69 | 70 | | Events | Description | 71 | | -- | -- | 72 | | A | Description | 73 | | B | Description | 74 | 75 | ## Examples 76 | 77 | 78 | 79 | ## Sample project 80 | 81 | 82 | [control/helper name sample page Source](sample-page-link). You can see this element in action in the [Xamarin community toolkit sample app](https://github.com/xamarin/XamarinCommunityToolkit/tree/main/XamarinCommunityToolkitSample). 83 | 84 | ## API 85 | 86 | - [control/helper name source code](source-code-link) 87 | 88 | ## Related links 89 | 90 | 91 | 92 | - [Topic 1](link) 93 | - [Topic 2](link) 94 | -------------------------------------------------------------------------------- /docs/TOC.yml: -------------------------------------------------------------------------------- 1 | - name: "Xamarin Community Toolkit Documentation" 2 | href: index.md 3 | - name: "Setup" 4 | items: 5 | - name: "Getting Started with the Xamarin Community Toolkit" 6 | href: get-started.md 7 | - name: "Behaviors" 8 | items: 9 | - name: AnimationBehavior 10 | href: behaviors/animationbehavior.md 11 | - name: CharactersValidationBehavior 12 | href: behaviors/charactersvalidationbehavior.md 13 | - name: EmailValidationBehavior 14 | href: behaviors/emailvalidationbehavior.md 15 | - name: EventToCommandBehavior 16 | href: behaviors/eventtocommandbehavior.md 17 | - name: ImpliedOrderGridBehavior 18 | href: behaviors/ImpliedOrderGridBehavior.md 19 | - name: MaskedBehavior 20 | href: behaviors/maskedbehavior.md 21 | - name: MaxLengthReachedBehavior 22 | href: behaviors/maxlengthreachedbehavior.md 23 | - name: MultiValidationBehavior 24 | href: behaviors/multivalidationbehavior.md 25 | - name: NumericValidationBehavior 26 | href: behaviors/numericvalidationbehavior.md 27 | - name: RequiredStringValidationBehavior 28 | href: behaviors/requiredstringvalidationbehavior.md 29 | - name: SetFocusOnEntryCompletedBehavior 30 | href: behaviors/setfocusonentrycompletedbehavior.md 31 | - name: TextValidationBehavior 32 | href: behaviors/textvalidationbehavior.md 33 | - name: UriValidationBehavior 34 | href: behaviors/urivalidationbehavior.md 35 | - name: UserStoppedTypingBehavior 36 | href: behaviors/userstoppedtypingbehavior.md 37 | - name: ValidationBehavior 38 | href: behaviors/validationbehavior.md 39 | - name: "Converters" 40 | items: 41 | - name: BoolToObjectConverter 42 | href: converters/booltoobjectconverter.md 43 | - name: ByteArrayToImageSourceConverter 44 | href: converters/bytearraytoimagesourceconverter.md 45 | - name: CompareConverter 46 | href: converters/compareconverter.md 47 | - name: DateTimeOffsetConverter 48 | href: converters/datetimeoffsetconverter.md 49 | - name: DoubleToIntConverter 50 | href: converters/doubletointconverter.md 51 | - name: EnumToBoolConverter 52 | href: converters/enumtoboolconverter.md 53 | - name: EnumToIntConverter 54 | href: converters/enumtointconverter.md 55 | - name: EqualConverter 56 | href: converters/equalconverter.md 57 | - name: IndexToArrayItemConverter 58 | href: converters/indextoarrayitemconverter.md 59 | - name: IntToBoolConverter 60 | href: converters/inttoboolconverter.md 61 | - name: InvertedBoolConverter 62 | href: converters/invertedboolconverter.md 63 | - name: IsInRangeConverter 64 | href: converters/isinrangeconverter.md 65 | - name: IsNotNullOrEmptyConverter 66 | href: converters/isnotnulloremptyconverter.md 67 | - name: IsNullOrEmptyConverter 68 | href: converters/isnulloremptyconverter.md 69 | - name: ItemSelectedEventArgsConverter 70 | href: converters/itemselectedeventargsconverter.md 71 | - name: ItemTappedEventArgsConverter 72 | href: converters/itemtappedeventargsconverter.md 73 | - name: ListIsNotNullOrEmptyConverter 74 | href: converters/listisnotnulloremptyconverter.md 75 | - name: ListIsNullOrEmptyConverter 76 | href: converters/listisnulloremptyconverter.md 77 | - name: ListToStringConverter 78 | href: converters/listtostringconverter.md 79 | - name: MathExpressionConverter 80 | href: converters/mathexpressionconverter.md 81 | - name: MultiConverter 82 | href: converters/multiconverter.md 83 | - name: NotEqualConverter 84 | href: converters/notequalconverter.md 85 | - name: StringToListConverter 86 | href: converters/stringtolistconverter.md 87 | - name: TextCaseConverter 88 | href: converters/textcaseconverter.md 89 | - name: VariableMultiValueConverter 90 | href: converters/variablemultivalueconverter.md 91 | - name: "Effects" 92 | items: 93 | - name: "LifecycleEffect" 94 | href: effects/lifecycleeffect.md 95 | - name: "SafeAreaEffect" 96 | href: effects/safeareaeffect.md 97 | - name: "Extensions" 98 | items: 99 | - name: "ImageResourceExtension" 100 | href: extensions/imageresourceextension.md 101 | - name: "TranslateExtension" 102 | href: extensions/translateextension.md 103 | - name: "Helpers" 104 | items: 105 | - name: "DelegateWeakEventManager" 106 | href: helpers/delegateweakeventmanager.md 107 | - name: "LocalizationResourceManager" 108 | href: helpers/localizationresourcemanager.md 109 | - name: "LocalizedString" 110 | href: helpers/localizedstring.md 111 | - name: "WeakEventManager" 112 | href: helpers/weakeventmanagert.md 113 | - name: "WeakEventManagerExtensions" 114 | href: helpers/weakeventmanagerextensions.md 115 | - name: "ObjectModel" 116 | items: 117 | - name: "AsyncCommand" 118 | href: objectmodel/asynccommand.md 119 | - name: "AsyncValueCommand" 120 | href: objectmodel/asyncvaluecommand.md 121 | - name: "CommandFactory" 122 | href: objectmodel/commandfactory.md 123 | - name: "Markup" 124 | href: markup.md 125 | - name: "Views" 126 | items: 127 | - name: "AvatarView" 128 | href: views/avatarview.md 129 | - name: "BadgeView" 130 | href: views/badgeview.md 131 | - name: "CameraView" 132 | href: views/cameraview.md 133 | - name: "DockLayout" 134 | href: views/docklayout.md 135 | - name: "Expander" 136 | href: views/expander.md 137 | - name: "LazyView" 138 | href: views/lazyview.md 139 | - name: "MediaElement" 140 | href: views/mediaelement.md 141 | - name: "Popup" 142 | href: views/popup.md 143 | - name: "RangeSlider" 144 | href: views/rangeslider.md 145 | - name: "Shield" 146 | href: views/shield.md 147 | - name: "StateLayout" 148 | href: views/statelayout.md 149 | - name: "TabView" 150 | href: views/tabview.md 151 | - name: "UniformGrid" 152 | href: views/uniformgrid.md 153 | - name: "Troubleshooting" 154 | href: troubleshooting.md 155 | -------------------------------------------------------------------------------- /docs/behaviors/animationbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit AnimationBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The AnimationBehavior allows the user to add an animation when an event is raised." 6 | ms.date: 12/08/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit AnimationBehavior 10 | 11 | The AnimationBehavior is a behavior that allows the user to add an animation when an event is raised. It offers various built-in animations such as fade, flip and scale. These are exposed through an instance of the `AnimationBase` class. Additional properties handling an event are inherited from [EventToCommandBehavior](eventtocommandbehavior.md). 12 | 13 | ## Syntax 14 | 15 | ```xml 16 | 28 | ``` 29 | 30 | ## Animations 31 | The AnimationBehavior exposes a rich set of [Animation types](animationtypes.md) 32 | 33 | ## Properties 34 | 35 | |Property |Type |Description | 36 | |---------|---------|---------| 37 | | AnimationType | AnimationBase | Provides an animation definition for the behavior to execute. | 38 | | AnimateCommand | [`ICommand`](xref:System.Windows.Input.ICommand) | Provides a mechanism to trigger the animation by executing a command. This property uses the `OneWayToSource` binding mode. | 39 | 40 | ## Sample 41 | 42 | - [AnimationBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/AnimationBehaviorPage.xaml) 43 | 44 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 45 | 46 | ## API 47 | 48 | * [AnimationBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/Animations/AnimationBehavior.shared.cs) 49 | -------------------------------------------------------------------------------- /docs/behaviors/animationtypes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit AnimationTypes" 3 | author: bijington 4 | ms.author: joverslu 5 | description: "The AnimationType allows the user to perform an animation." 6 | ms.date: 10/28/2021 7 | --- 8 | 9 | # Xamarin Community Toolkit AnimationTypes 10 | 11 | These represent types of animations that can be either be attached to views through the [AnimationBehavior](animationbehavior.md) or created programmatically and simply executed. 12 | 13 | There are 2 differing types: 14 | 15 | ## 1. Simple animation (AnimationBase) 16 | 17 | Each animation has its own properties which can be set such as `Duration` and `Easing` which they inherit from `AnimationBase`. Each animation also exposes its own properties, depending on what kind of animation it is. They can be used in the following ways: 18 | 19 | ### Attached 20 | 21 | These can all be hooked up to be triggered by an event by attaching an [AnimationBehavior](animationbehavior.md) to the control. The `Animate` method receives the View that the behavior is attached to as a parameter. 22 | 23 | ```xml 24 | 25 | 26 | 30 | 31 | 32 | ``` 33 | 34 | ### Code behind 35 | 36 | An animation can also be constructed from code behind and manually triggered. 37 | 38 | ```csharp 39 | var fadeAnimation = FadeAnimation 40 | { 41 | Easing = Easing.Linear, 42 | Duration = 100 43 | }; 44 | 45 | await fadeAnimation.Animate(myView); 46 | ``` 47 | 48 | ### Custom implementation 49 | 50 | The user can also create custom animations by inheriting from `AnimationBase` and implementing the `Animate` method. 51 | 52 | ```csharp 53 | public class FadeAnimation : AnimationBase 54 | { 55 | public static readonly BindableProperty FadeProperty = 56 | BindableProperty.Create(nameof(Fade), typeof(double), typeof(AnimationBase), 0.3, BindingMode.TwoWay); 57 | 58 | public double Fade 59 | { 60 | get => (double)GetValue(FadeProperty); 61 | set => SetValue(FadeProperty, value); 62 | } 63 | 64 | protected override uint DefaultDuration { get; set; } = 300; 65 | 66 | public override async Task Animate(View? view) 67 | { 68 | if (view != null) 69 | { 70 | await view.FadeTo(Fade, Duration, Easing); 71 | await view.FadeTo(1, Duration, Easing); 72 | } 73 | } 74 | } 75 | ``` 76 | 77 | ## 2. Compound animation (CompoundAnimationBase) 78 | 79 | `CompoundAnimationBase` animations allow for the same behavior as `AnimationBase` with the following extra possibilities: 80 | 81 | 1. ability to animate multiple views 82 | 2. ability to cancel the animation 83 | 3. ability to control repetition of the animation 84 | 85 | ### Attached 86 | 87 | These can all be hooked up to be triggered by an event by attaching an [AnimationBehavior](animationbehavior.md) to the control. The `Animate` method receives the View that the behavior is attached to as a parameter. 88 | 89 | ```xml 90 | 91 | 92 | 97 | 98 | 99 | ``` 100 | 101 | ### Code behind 102 | 103 | An animation can also be constructed from code behind and manually triggered. 104 | 105 | ```csharp 106 | var cancelAnimationTokenSource = new CancellationTokenSource(); 107 | 108 | var animation = RubberBandAnimation 109 | { 110 | Easing = Easing.Linear, 111 | Duration = 100 112 | }; 113 | 114 | await animation.Animate(cancelAnimationTokenSource.Token, myView, myView2); 115 | 116 | // Cancel when you wish to stop the animation: 117 | cancelAnimationTokenSource.Cancel(); 118 | ``` 119 | 120 | ### Custom implementation 121 | 122 | The user can also create custom animations by inheriting from `CompoundAnimationBase` and implementing the `CreateAnimation` method. 123 | 124 | ```csharp 125 | public class RubberBandAnimation : CompoundAnimationBase 126 | { 127 | protected override uint DefaultDuration { get; set; } = 1000; 128 | 129 | protected override Animation CreateAnimation(params View[] views) 130 | { 131 | var animation = new Animation(); 132 | 133 | foreach (var view in views) 134 | { 135 | animation.Add(0, 0.3, new Animation(v => view.ScaleX = v, 1, 1.25)); 136 | animation.Add(0, 0.3, new Animation(v => view.ScaleY = v, 1, 0.75)); 137 | 138 | animation.Add(0.3, 0.4, new Animation(v => view.ScaleX = v, 1.25, 0.75)); 139 | animation.Add(0.3, 0.4, new Animation(v => view.ScaleY = v, 0.75, 1.25)); 140 | 141 | animation.Add(0.4, 0.5, new Animation(v => view.ScaleX = v, 0.75, 1.15)); 142 | animation.Add(0.4, 0.5, new Animation(v => view.ScaleY = v, 1.25, 0.85)); 143 | 144 | animation.Add(0.5, 0.65, new Animation(v => view.ScaleX = v, 1.15, 0.95)); 145 | animation.Add(0.5, 0.65, new Animation(v => view.ScaleY = v, 0.85, 1.05)); 146 | 147 | animation.Add(0.65, 0.75, new Animation(v => view.ScaleX = v, 0.95, 1.05)); 148 | animation.Add(0.65, 0.75, new Animation(v => view.ScaleY = v, 1.05, 0.95)); 149 | 150 | animation.Add(0.75, 1, new Animation(v => view.ScaleX = v, 1.05, 1)); 151 | animation.Add(0.75, 1, new Animation(v => view.ScaleY = v, 0.95, 1)); 152 | } 153 | 154 | return animation; 155 | } 156 | } 157 | ``` 158 | 159 | ## Sample 160 | 161 | - [Animations sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Animations/AnimationPage.xaml) 162 | 163 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). -------------------------------------------------------------------------------- /docs/behaviors/charactersvalidationbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit CharactersValidationBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The CharactersValidationBehavior allows the user to validate a text input depending on specified parameters." 6 | ms.date: 12/07/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit CharactersValidationBehavior 10 | 11 | The CharactersValidationBehavior is a behavior that allows the user to validate text input depending on specified parameters. For example, an `Entry` control can be styled differently depending on whether a valid or an invalid text value is provided. This behavior includes built-in checks such as checking for a certain number of digits or alphanumeric characters. Additional properties handling validation are inherited from [ValidationBehavior](validationbehavior.md). 12 | 13 | ## Syntax 14 | 15 | ```xml 16 | 17 | 18 | 23 | 24 | 25 | ``` 26 | 27 | ## Properties 28 | 29 | |Property |Type |Description | 30 | |---------|---------|---------| 31 | | CharacterType | CharacterType | Provides an enumerated value to use to set how to handle comparisons. | 32 | | MaximumCharacterCount | int | The maximum length of the text input that's allowed. | 33 | | MinimumCharacterCount | int | The minimum length of the text input that's allowed. | 34 | 35 | ## Sample 36 | 37 | - [CharactersValidationBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/CharactersValidationBehaviorPage.xaml) 38 | 39 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 40 | 41 | ## API 42 | 43 | * [CharactersValidationBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/Validators/CharactersValidationBehavior.shared.cs) 44 | -------------------------------------------------------------------------------- /docs/behaviors/emailvalidationbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit EmailValidationBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The EmailValidationBehavior allows users to determine whether or not text input is a valid e-mail address." 6 | ms.date: 12/07/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit EmailValidationBehavior 10 | 11 | The EmailValidationBehavior is a behavior that allows users to determine whether or not text input is a valid e-mail address. For example, an `Entry` control can be styled differently depending on whether a valid or an invalid e-mail address is provided. The validation is achieved through a regular expression that is used to verify whether or not the text input is a valid e-mail address. It can be overridden to customize the validation through the properties it inherits from [ValidationBehavior](validationbehavior.md). 12 | 13 | ## Syntax 14 | 15 | ```xml 16 | 17 | 18 | 22 | 23 | 24 | ``` 25 | 26 | ## Properties 27 | 28 | |Property |Type |Description | 29 | |---------|---------|---------| 30 | | DefaultRegexPattern | string | The regular expression used to verify whether or not the text input is a valid e-mail address. | 31 | 32 | ## Sample 33 | 34 | - [EmailValidationBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/EmailValidationBehaviorPage.xaml) 35 | 36 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 37 | 38 | ## API 39 | 40 | * [EmailValidationBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/Validators/EmailValidationBehavior.shared.cs) 41 | -------------------------------------------------------------------------------- /docs/behaviors/eventtocommandbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit EventToCommandBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The EventToCommandBehavior allows the user to invoke a Command through an event." 6 | ms.date: 12/07/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit EventToCommandBehavior 10 | 11 | The EventToCommandBehavior is a behavior that allows the user to invoke a Command through an event. It is designed to associate Commands to events exposed by controls that were not designed to support Commands. It allows you to map any arbitrary event on a control to a Command. 12 | 13 | ## Syntax 14 | 15 | This behavior can be used on any control that exposes events, such as a `Button`: 16 | 17 | ```xml 18 | 19 | 22 | 23 | ``` 24 | 25 | When using this behavior with selection or tap events exposed by `ListView` an additional converter is required. This converter converts the event arguments to a command parameter which is then passed onto the Command. They are also available in the Xamarin Community Toolkit: 26 | 27 | - [ItemSelectedEventArgsConverter](~/converters/itemselectedeventargsconverter.md) 28 | - [ItemTappedEventArgsConverter](~/converters/itemtappedeventargsconverter.md) 29 | 30 | ## Properties 31 | 32 | |Property |Type |Description | 33 | |---------|---------|---------| 34 | | EventName | string | The name of the event that should be associated with a `Command`. | 35 | | Command | [ICommand](xref:System.Windows.Input.ICommand) | The `Command` that should be executed. | 36 | | CommandParameter | object | An optional parameter to forward to the `Command`. | 37 | | EventArgsConverter | [IValueConverter](xref:Xamarin.Forms.IValueConverter) | An optional `IValueConverter` that can be used to convert `EventArgs` values to values passed into the `Command`. | 38 | 39 | ## Sample 40 | 41 | - [EventToCommandBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/EventToCommandBehaviorPage.xaml) 42 | 43 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 44 | 45 | ## API 46 | 47 | * [EventToCommandBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/EventToCommandBehavior.shared.cs) 48 | -------------------------------------------------------------------------------- /docs/behaviors/impliedordergridbehavior-images/ImpliedOrderGridBehavior.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicrosoftDocs/xamarin-communitytoolkit/1a99b30aa67aa1ab98755ebd431280ffcf306e7d/docs/behaviors/impliedordergridbehavior-images/ImpliedOrderGridBehavior.png -------------------------------------------------------------------------------- /docs/behaviors/impliedordergridbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit ImpliedOrderGridBehavior" 3 | description: "A behavior for a grid that assigns grid column and row assignments based on the order children are added to the grid." 4 | author: bmacombe 5 | ms.author: joverslu 6 | ms.date: 10/22/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit ImpliedOrderGridBehavior 10 | 11 | The ImpliedOrderGridBehavior enables you to automatically assign a `Grid` row and column to a view based on the order the view is added to the `Grid`. You only need to setup the row and column definitions and then add children to the Grid. You may still assign `RowSpan` and `ColumnSpan` to views and their values will be taken into account when assigning a row and column to a view. If a view has a user defined row or column value it will be honored. 12 | 13 | ## Logging and exceptions 14 | 15 | By default the behavior will log warnings for the following conditions: 16 | 17 | - The number of children added to the Grid exceeds the number of available cells based on the row and column definitions. 18 | - A child with a ColumnSpan value that exceeds the number of columns to it's right. 19 | - A child with a RowSpan value that exceeds the number of rows below it. 20 | - A child with a user assigned row and/or column is placed over an already placed child. 21 | 22 | > [!NOTE] 23 | > You may optionally set the `ThrowOnLayoutWarning` property to `true`, which will raise exceptions instead of warnings. 24 | 25 | ## Syntax 26 | 27 | ```xaml 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | ``` 69 | 70 | ![Example layout image.](impliedordergridbehavior-images/ImpliedOrderGridBehavior.png) 71 | 72 | ## Properties 73 | 74 | |Property |Type |Description | 75 | |---------|---------|---------| 76 | |ThrowOnLayoutWarning|bool|When true warnings will throw an exception instead of being logged. Defaults to false.| 77 | 78 | ## Sample 79 | 80 | - [ImpliedOrderGridBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/ImpliedOrderGridBehaviorPage.xaml) 81 | 82 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 83 | 84 | ## API 85 | 86 | - [ImpliedOrderGridBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/ImpliedOrderGridBehavior.shared.cs) 87 | -------------------------------------------------------------------------------- /docs/behaviors/maskedbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit MaskedBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The MaskedBehavior allows the user to define an input mask for data entry." 6 | ms.date: 12/07/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit MaskedBehavior 10 | 11 | The MaskedBehavior is a behavior that allows the user to define an input mask for data entry. Adding this behavior to an `Entry` control will force the user to only input values matching a given mask. Examples of its usage include input of a credit card number or a phone number. 12 | 13 | ## Syntax 14 | 15 | ```xml 16 | 17 | 18 | 22 | 23 | 24 | ``` 25 | 26 | ## Properties 27 | 28 | |Property |Type |Description | 29 | |---------|---------|---------| 30 | | Mask | string | The mask that the input value needs to match. | 31 | | UnMaskedCharacter | string | The placeholder character for when no input has been given yet. | 32 | 33 | 34 | ## Sample 35 | 36 | - [MaskedBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/MaskedBehaviorPage.xaml) 37 | 38 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 39 | 40 | ## API 41 | 42 | * [MaskedBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/MaskedBehavior.shared.cs) 43 | -------------------------------------------------------------------------------- /docs/behaviors/maxlengthreachedbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit MaxLengthReachedBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The MaxLengthReachedBehavior allows the user to trigger an action when a user has reached the maximum length allowed on an Entry." 6 | ms.date: 12/08/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit MaxLengthReachedBehavior 10 | 11 | The MaxLengthReachedBehavior is a behavior that allows the user to trigger an action when a user has reached the maximum length allowed on an `Entry`. It can either trigger a `Command` or an `event` depending on the user's preferred scenario. 12 | 13 | ## Syntax 14 | 15 | ```xml 16 | < 19 | 20 | 24 | 25 | 26 | 27 | 30 | 31 | 35 | 36 | 37 | ``` 38 | 39 | ## Properties 40 | 41 | |Property |Type |Description | 42 | |---------|---------|---------| 43 | | Command | [ICommand](xref:System.Windows.Input.ICommand) | The command to execute when the user has reached the maximum length. | 44 | | ShouldDismissKeyboardAutomatically | int | Indicates whether or not the keyboard should be dismissed automatically. | 45 | 46 | ## Events 47 | 48 | |Event | Description | 49 | |---------|---------| 50 | | MaxLengthReached | The event to raise when the user has reached the maximum length. | 51 | 52 | ## Sample 53 | 54 | - [MaxLengthReachedBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml) 55 | 56 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 57 | 58 | ## API 59 | 60 | * [MaxLengthReachedBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/MaxLengthReachedBehavior.shared.cs) 61 | -------------------------------------------------------------------------------- /docs/behaviors/multivalidationbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit MultiValidationBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The MultiValidationBehavior allows the user to combine multiple validators to validate text input depending on specified parameters." 6 | ms.date: 12/07/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit MultiValidationBehavior 10 | 11 | The MultiValidationBehavior is a behavior that allows the user to combine multiple validators to validate text input depending on specified parameters. For example, an `Entry` control can be styled differently depending on whether a valid or an invalid text input is provided. By allowing the user to chain multiple existing validators together, it offers a high degree of customizability when it comes to validation. Additional properties handling validation are inherited from [ValidationBehavior](validationbehavior.md). 12 | 13 | ## Syntax 14 | 15 | ```xml 16 | 17 | 18 | 21 | 22 | 25 | 29 | 33 | 34 | 35 | 36 | 37 | ``` 38 | 39 | ## Properties 40 | 41 | |Property |Type |Description | 42 | |---------|---------|---------| 43 | | Error | object | An attached property on nested validators setting the error message for that validator. | 44 | | Errors | `List` | Holds the errors from all of the nested invalid validators. | 45 | 46 | ## Sample 47 | 48 | - [MultiValidationBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/MultiValidationBehaviorPage.xaml) 49 | 50 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 51 | 52 | ## API 53 | 54 | * [MultiValidationBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/Validators/MultiValidationBehavior.shared.cs) 55 | -------------------------------------------------------------------------------- /docs/behaviors/numericvalidationbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit NumericValidationBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The NumericValidationBehavior allows the user to determine if text input is a valid numeric value." 6 | ms.date: 12/07/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit NumericValidationBehavior 10 | 11 | The NumericValidationBehavior is a behavior that allows the user to determine if text input is a valid numeric value. For example, an `Entry` control can be styled differently depending on whether a valid or an invalid numeric input is provided. Additional properties handling validation are inherited from [ValidationBehavior](validationbehavior.md). 12 | 13 | ## Syntax 14 | 15 | ```xml 16 | 17 | 18 | 23 | 24 | 25 | ``` 26 | 27 | ## Properties 28 | 29 | |Property |Type |Description | 30 | |---------|---------|---------| 31 | | MaximumDecimalPlaces | int | The maximum number of decimal places that will be allowed. | 32 | | MaximumValue | double | The maximum numeric value that will be allowed. | 33 | | MinimumDecimalPlaces | int | The minimum number of decimal places that will be allowed. | 34 | | MinimumValue | double | The minimum numeric value that will be allowed. | 35 | 36 | 37 | ## Sample 38 | 39 | - [NumericValidationBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/NumericValidationBehaviorPage.xaml) 40 | 41 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 42 | 43 | ## API 44 | 45 | * [NumericValidationBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/Validators/NumericValidationBehavior.shared.cs) 46 | -------------------------------------------------------------------------------- /docs/behaviors/requiredstringvalidationbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit RequiredStringValidationBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The RequiredStringValidationBehavior allows the user to determine if text input is equal to specific text." 6 | ms.date: 12/08/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit RequiredStringValidationBehavior 10 | 11 | The RequiredStringValidationBehavior is a behavior that allows the user to determine if text input is equal to specific text. For example, an `Entry` control can be styled differently depending on whether a valid or an invalid text input is provided. Additional properties handling validation are inherited from [ValidationBehavior](validationbehavior.md). 12 | 13 | ## Syntax 14 | 15 | ```xml 16 | 17 | 18 | 22 | 23 | 24 | ``` 25 | 26 | ## Properties 27 | 28 | |Property |Type |Description | 29 | |---------|---------|---------| 30 | | RequiredString | string | The string that will be compared to the value provided by the user. | 31 | 32 | 33 | ## Sample 34 | 35 | - [RequiredStringValidationBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/RequiredStringValidationBehaviorPage.xaml) 36 | 37 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 38 | 39 | ## API 40 | 41 | * [RequiredStringValidationBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/Validators/RequiredStringValidationBehavior.shared.cs) 42 | -------------------------------------------------------------------------------- /docs/behaviors/setfocusonentrycompletedbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit SetFocusedOnEntryCompletedBehavior" 3 | author: jmegner 4 | ms.author: joverslu 5 | description: "The SetFocusedOnEntryCompletedBehavior gives focus to a specific visual element when an entry is completed." 6 | ms.date: 03/03/2021 7 | --- 8 | 9 | # Xamarin Community Toolkit SetFocusedOnEntryCompletedBehavior 10 | 11 | The `SetFocusedOnEntryCompletedBehavior` is a behavior that gives focus to a specified visual element when an entry is completed. For example, a page might have several entries in sequence, and it would be convenient to the user if completing an entry automatically switched focus to the next entry. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 17 | 21 | 25 | 28 | 29 | ``` 30 | 31 | ## Properties 32 | 33 | |Property |Type |Description | 34 | |---------|---------|---------| 35 | | NextElement | VisualElement | The `VisualElement` that should gain focus once the `Entry` is completed. | 36 | 37 | ## Sample 38 | 39 | - [SetFocusedOnEntryCompletedBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/SetFocusOnEntryCompletedBehaviorPage.xaml) 40 | 41 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 42 | 43 | ## API 44 | 45 | * [SetFocusedOnEntryCompletedBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/AttachedBehaviors/SetFocusOnEntryCompletedBehavior.shared.cs) 46 | -------------------------------------------------------------------------------- /docs/behaviors/textvalidationbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit TextValidationBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The TextValidationBehavior allows the user to validate a given text depending on specified parameters." 6 | ms.date: 12/07/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit TextValidationBehavior 10 | 11 | The TextValidationBehavior is a behavior that allows the user to validate a given text depending on specified parameters. By adding this behavior to an `Entry` control it can be styled differently depending on whether a valid or an invalid text value is provided. It offers various built-in checks such as checking for a certain length or whether or not the input value matches a specific regular expression. Additional properties handling validation are inherited from [ValidationBehavior](validationbehavior.md). 12 | 13 | ## Syntax 14 | 15 | ```xml 16 | 17 | 18 | 23 | 24 | 25 | ``` 26 | 27 | ## Properties 28 | 29 | |Property |Type |Description | 30 | |---------|---------|---------| 31 | | DecorationFlags | TextDecorationFlags | Provides enumerated value to use to set how to handle white spaces. | 32 | | MaximumLength | int | The maximum length of the value that will be allowed. | 33 | | MinimumLength | int | The minimum length of the value that will be allowed. | 34 | | RegexOptions | [RegexOptions](xref:System.Text.RegularExpressions.RegexOptions) | Provides enumerated values to use to set regular expression options. | 35 | | RegexPattern | string | The regular expression pattern which the value will have to match before it will be allowed. | 36 | 37 | ## Sample 38 | 39 | > [!NOTE] 40 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 41 | 42 | ## API 43 | 44 | - [TextValidationBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/Validators/TextValidationBehavior.shared.cs) 45 | -------------------------------------------------------------------------------- /docs/behaviors/urivalidationbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit UriValidationBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The UriValidationBehavior allows users to determine whether or not text input is a valid URI." 6 | ms.date: 12/07/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit UriValidationBehavior 10 | 11 | The UriValidationBehavior is a behavior that allows users to determine whether or not text input is a valid URI. For example, an `Entry` control can be styled differently depending on whether a valid or an invalid URI is provided. Additional properties handling validation are inherited from [ValidationBehavior](validationbehavior.md). 12 | 13 | ## Syntax 14 | 15 | ```xml 16 | 17 | 18 | 22 | 23 | 24 | ``` 25 | 26 | ## Properties 27 | 28 | |Property |Type |Description | 29 | |---------|---------|---------| 30 | | UriKind | [UriKind](xref:System.UriKind) | Provides an enumerated value that specifies how to handle different URI types. | 31 | 32 | 33 | ## Sample 34 | 35 | - [UriValidationBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/UriValidationBehaviorPage.xaml) 36 | 37 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 38 | 39 | ## API 40 | 41 | * [UriValidationBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/Validators/UriValidationBehavior.shared.cs) 42 | -------------------------------------------------------------------------------- /docs/behaviors/userstoppedtypingbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit UserStoppedTypingBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The UserStoppedTypingBehavior allows the user to trigger an action when a user has stopped data input into an Entry." 6 | ms.date: 12/08/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit UserStoppedTypingBehavior 10 | 11 | The UserStoppedTypingBehavior is a behavior that allows the user to trigger an action when a user has stopped data input an `Entry`. Examples of its usage include triggering a search when a user has stopped entering their search query. 12 | 13 | ## Syntax 14 | 15 | ```xml 16 | 17 | 18 | 23 | 24 | 25 | ``` 26 | 27 | ## Properties 28 | 29 | |Property |Type |Description | 30 | |---------|---------|---------| 31 | | Command | [ICommand](xref:System.Windows.Input.ICommand) | The command to execute when the user has stopped providing input. | 32 | | MinimumLengthThreshold | int | The minimum length of the input value required before the command will be executed. | 33 | | ShouldDismissKeyboardAutomatically | bool | Indicates whether or not the keyboard should be dismissed automatically. | 34 | | StoppedTypingTimeThreshold | int | The time of inactivity in milliseconds after which the command will be executed. | 35 | 36 | ## Sample 37 | 38 | - [UserStoppedTypingBehavior sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Behaviors/UserStoppedTypingBehaviorPage.xaml) 39 | 40 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 41 | 42 | ## API 43 | 44 | * [UserStoppedTypingBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/UserStoppedTypingBehavior.shared.cs) 45 | 46 | ## Related video 47 | 48 | > [!Video https://channel9.msdn.com/Shows/XamarinShow/User-Stopped-Typing-Behavior-Xamarin-Community-Toolkit/player] -------------------------------------------------------------------------------- /docs/behaviors/validationbehavior.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit ValidationBehavior" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The ValidationBehavior allows users to create custom validation behaviors." 6 | ms.date: 12/07/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit ValidationBehavior 10 | 11 | The ValidationBehavior allows users to create custom validation behaviors. All of the validation behaviors in the Xamarin Community Toolkit inherit from this behavior, to expose a number of shared properties. Users can inherit from this class to create a custom validation behavior currently not supported through the Xamarin Community Toolkit. 12 | 13 | ## Properties 14 | 15 | |Property |Type |Description | 16 | |---------|---------|---------| 17 | | ForceValidateCommand | [ICommand](xref:System.Windows.Input.ICommand) | Allows the user to provide a custom ICommand that handles forcing validation. This is a bindable property. | 18 | | Flags | ValidationFlags | Provides an enumerated value that specifies how to handle validation. This is a bindable property. | 19 | | InvalidStyle | [Style](xref:Xamarin.Forms.Style) | The Style to apply to the element when validation fails. This is a bindable property. | 20 | | IsNotValid | bool | Indicates whether or not the current value is considered invalid. This is a bindable property. | 21 | | IsValid | bool | Indicates whether or not the current value is considered valid. This is a bindable property. | 22 | | ValidStyle | [Style](xref:Xamarin.Forms.Style) | The Style to apply to the element when validation is successful. | 23 | | Value | object | The value to validate. This is a bindable property. | 24 | | ValuePropertyName | string | Allows the user to override the property that will be used as the value to validate. This is a bindable property. | 25 | 26 | ## Visual States 27 | 28 | `ValidationBehavior` defines two visual states, `Valid` and `Invalid`, that can be used with the [Visual State Manager](/xamarin/xamarin-forms/user-interface/visual-state-manager), instead of the `InvalidStyle` and `ValidStyle` properties. 29 | 30 | Usage sample: 31 | ``` 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | ``` 57 | 58 | ## Sample 59 | 60 | > [!WARNING] 61 | > This class should not be used without inheriting from it. Therefore, there is no sample available. 62 | 63 | ## API 64 | 65 | * [ValidationBehavior source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Behaviors/Validators/ValidationBehavior.shared.cs) 66 | -------------------------------------------------------------------------------- /docs/breadcrumb/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Docs 2 | tocHref: / 3 | topicHref: / 4 | items: 5 | - name: Previous Versions 6 | tocHref: /previous-versions/ 7 | topicHref: /previous-versions/ 8 | items: 9 | - name: Xamarin 10 | tocHref: /previous-versions/xamarin/ 11 | topicHref: /previous-versions/xamarin/ 12 | items: 13 | - name: Xamarin Community Toolkit 14 | tocHref: /previous-versions/xamarin/community-toolkit/ 15 | topicHref: /previous-versions/xamarin/community-toolkit/ 16 | -------------------------------------------------------------------------------- /docs/converters/booltoobjectconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit BoolToObjectConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The BoolToObjectConverter allows users to convert a boolean into a specific object." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit BoolToObjectConverter 10 | 11 | The BoolToObjectConverter is a converter that allows users to convert a `bool` value binding to a specific object. By providing both a `TrueObject` and a `FalseObject` in the converter the appropriate object will be used depending on the value of the binding. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Properties 36 | 37 | |Property |Type |Description | 38 | |---------|---------|---------| 39 | | TrueObject | object | The object that will be used when the binding value is `true`. | 40 | | FalseObject | object | The object that will be used when the binding value is `false`. | 41 | 42 | ## Sample 43 | 44 | > [!NOTE] 45 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 46 | 47 | 50 | 51 | ## API 52 | 53 | * [BoolToObjectConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/BoolToObjectConverter.shared.cs) 54 | -------------------------------------------------------------------------------- /docs/converters/bytearraytoimagesourceconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit ByteArrayToImageSourceConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The ByteArrayToImageSourceConverter allows users to show an image based on a byte array." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit ByteArrayToImageSourceConverter 10 | 11 | The ByteArrayToImageSourceConverter is a converter that allows the user to convert an incoming value from byte array and returns an object of type `ImageSource`. This object can then be used as the `Source` of an `Image` control. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | ``` 33 | 34 | ## Sample 35 | 36 | [ByteArrayToImageSourceConverter sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/ByteArrayToImageSourcePage.xaml) 37 | 38 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 39 | 40 | ## API 41 | 42 | * [ByteArrayToImageSourceConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/ByteArrayToImageSourceConverter.shared.cs) 43 | -------------------------------------------------------------------------------- /docs/converters/compareconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit CompareConverter" 3 | author: Cfun1 4 | ms.author: joverslu 5 | description: "The CompareConverter allows users to convert a boolean into a specific object." 6 | ms.date: 05/04/2021 7 | --- 8 | 9 | # Xamarin Community Toolkit CompareConverter 10 | 11 | The `CompareConverter` is a converter that converts an object of a type implementing `IComparable`, and returns the comparison 12 | `[value] [ComparisonOperator] [ComparingValue]` result as a boolean if no objects were specified through the `TrueObject` and/or `FalseObject` properties. If values are assigned to the `TrueObject` and/or `FalseObject` properties the `CompareConverter` returns the respective object assigned. 13 | 14 | ## Syntax 15 | 16 | ```xaml 17 | 21 | 22 | 23 | 24 | 2 25 | 26 | 27 | 28 | 29 | 30 | 39 | 40 | ``` 41 | 42 | ## Properties 43 | 44 | |Property |Type |Description | 45 | |---------|---------|---------| 46 | | TrueObject | object | The object that will be returned when the binding value is `true`. | 47 | | FalseObject | object | The object that will be returned when the binding value is `false`. | 48 | | ComparisonOperator | OperatorType | The comparison operator. | 49 | | ComparingValue | IComparable | The object that the bound `value` will be compared to. | 50 | 51 | ## OperatorType 52 | The `OperatorType` enumeration defines the following members: 53 | - Greater 54 | - GreaterOrEqual 55 | - Equal 56 | - SmallerOrEqual 57 | - Smaller 58 | - NotEqual 59 | 60 | ## Sample 61 | 62 | > [!NOTE] 63 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/CompareConverterPage.xaml). 64 | 65 | ## API 66 | 67 | * [CompareConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/CompareConverter.shared.cs) 68 | -------------------------------------------------------------------------------- /docs/converters/datetimeoffsetconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit DateTimeOffsetConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The DateTimeOffsetConverter allows users to convert a DateTimeOffset to a DateTime." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit DateTimeOffsetConverter 10 | 11 | The DateTimeOffsetConverter is a converter that allows users to convert a `DateTimeOffset` to a `DateTime`. Sometimes a datetime value is stored with the offset on a backend to allow for storing the timezone in which a `DateTime` originated from. Controls like the `DatePicker` in Xamarin.Forms will only work with `DateTime`. This converter can be used in those scenarios. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | ``` 33 | 34 | ## Sample 35 | 36 | [DateTimeOffsetConverter sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/DateTimeOffsetConverterPage.xaml) 37 | 38 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 39 | 40 | ## API 41 | 42 | * [DateTimeOffsetConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/DateTimeOffsetConverter.shared.cs) 43 | 44 | ## Related video 45 | 46 | > [!Video https://channel9.msdn.com/Shows/XamarinShow/Xamarin-Community-Toolkit-Forget-Time-Zones-with-DateTimeOffsetConverter/player] -------------------------------------------------------------------------------- /docs/converters/doubletointconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit DoubleToIntConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The DoubleToIntConverter allows users to convert an incoming double value to an int." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit DoubleToIntConverter 10 | 11 | The DoubleToIntConverter is a converter that allows users to convert an incoming `double` value to an `int`. Optionally the user can provide a multiplier to the conversion through the `Ratio` property. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Properties 36 | 37 | |Property |Type |Description | 38 | |---------|---------|---------| 39 | | Ratio | int | The multiplier to apply to the conversion. | 40 | 41 | ## Sample 42 | 43 | > [!NOTE] 44 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 45 | 46 | 49 | 50 | ## API 51 | 52 | * [DoubleToIntConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/DoubleToIntConverter.shared.cs) 53 | -------------------------------------------------------------------------------- /docs/converters/enumtoboolconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit EnumToBoolConverter" 3 | author: webducer 4 | ms.author: joverslu 5 | description: "The EnumToBoolConverter allows users to retrieve convert an enum value into a boolean value." 6 | ms.date: 02/17/2021 7 | --- 8 | 9 | # Xamarin Community Toolkit EnumToBoolConverter 10 | 11 | The EnumToBoolConverter is a converter that allows users to convert a `Enum` value binding to a `bool` value. The `Enum` value can be compared against the `TrueList` or against the `ConverterParameter`. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | New 28 | InReview 29 | Developing 30 | 31 | 32 | 33 | 34 | WantFix 35 | Resolved 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 52 | 53 | ``` 54 | 55 | ## Sample 56 | 57 | > [!NOTE] 58 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 59 | 60 | 63 | 64 | ## API 65 | 66 | * [IndexToArrayItemConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/EnumToBoolConverter.shared.cs) 67 | -------------------------------------------------------------------------------- /docs/converters/enumtointconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit EnumToIntConverter" 3 | author: Hottemax 4 | ms.author: joverslu 5 | description: "The EnumToIntConverter is a converter that allows users to convert a standard enum (extending int) to its underlying primitive int type." 6 | ms.date: 05/20/2021 7 | --- 8 | 9 | # Xamarin Community Toolkit EnumToIntConverter 10 | ![Pre-release API.](~/images/pre-release.png) 11 | 12 | The EnumToIntConverter is a converter that allows you to convert a standard `Enum` (extending `int`) to its underlying primitive `int` type. 13 | It is useful when binding a collection of values representing an enumeration type with default numbering to a control such as a [`Picker`](xref:Xamarin.Forms.Picker). 14 | 15 | For localization purposes or due to other requirements, the enum values often need to be converted to a human-readable string. 16 | In this case, when the user selects a value, the resulting [`SelectedIndex`](xref:Xamarin.Forms.Picker.SelectedIndex) 17 | can easily be converted to the underlying `enum` value without requiring additional work in the associated viewmodel. 18 | 19 | ## Syntax 20 | 21 | ```xaml 22 | 23 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | ``` 39 | 40 | ## Sample 41 | 42 | - [EnumToIntConverter sample page source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/EnumToIntConverterPage.xaml) 43 | - [EnumToIntConverter sample viewmodel source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/ViewModels/Converters/EnumToIntConverterViewModel.cs) 44 | 45 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 46 | 47 | ## API 48 | 49 | * [EnumToIntConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/EnumToIntConverter.shared.cs) 50 | 51 | ## Related video 52 | 53 | > [!Video https://channel9.msdn.com/Shows/XamarinShow/EnumToIntConverter-Xamarin-Community-Toolkit/player] 54 | -------------------------------------------------------------------------------- /docs/converters/equalconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit EqualConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The EqualConverter allows users to check whether or not a binding value equals another value." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit EqualConverter 10 | 11 | The EqualConverter is a converter that allows users to convert any value binding to a `bool` depending on whether or not it is equal to a different value. The initial binding contains the object that will be compared and the `ConverterParameter` contains the object to compare it to. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Sample 36 | 37 | > [!NOTE] 38 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 39 | 40 | 43 | 44 | ## API 45 | 46 | * [EqualConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/EqualConverter.shared.cs) 47 | -------------------------------------------------------------------------------- /docs/converters/indextoarrayitemconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit IndexToArrayItemConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The IndexToArrayItemConverter allows users to retrieve an item from an array based on the binding of an indexer." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit IndexToArrayItemConverter 10 | 11 | The IndexToArrayItemConverter is a converter that allows users to convert a `int` value binding to an item in an array. The `int` value being data bound represents the indexer used to access the array. The array is passed in through the `ConverterParameter`. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | Value 1 26 | Value 2 27 | Value 3 28 | Value 4 29 | Value 5 30 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | ``` 41 | 42 | ## Sample 43 | 44 | > [!NOTE] 45 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 46 | 47 | 50 | 51 | ## API 52 | 53 | * [IndexToArrayItemConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/IndexToArrayItemConverter.shared.cs) 54 | -------------------------------------------------------------------------------- /docs/converters/inttoboolconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit IntToBoolConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The IntToBoolConverter allows users to convert an incoming integer value to a boolean." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit IntToBoolConverter 10 | 11 | The IntToBoolConverter is a converter that allows users to convert an incoming `int` value to a `bool`. If the incoming `int` value is 0, it will be converted to `false`. Any other incoming value will be converted to `true`. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Sample 36 | 37 | > [!NOTE] 38 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 39 | 40 | 43 | 44 | ## API 45 | 46 | * [IntToBoolConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/IntToBoolConverter.shared.cs) 47 | -------------------------------------------------------------------------------- /docs/converters/invertedboolconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit InvertedBoolConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The InvertedBoolConverter allows users to invert a boolean value binding." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit InvertedBoolConverter 10 | 11 | The InvertedBoolConverter is a converter that allows users to convert a `bool` value binding to its inverted value. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Sample 36 | 37 | > [!NOTE] 38 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 39 | 40 | 43 | 44 | ## API 45 | 46 | * [InvertedBoolConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/InvertedBoolConverter.shared.cs) 47 | -------------------------------------------------------------------------------- /docs/converters/isinrangeconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit IsInRangeConverter" 3 | author: guoldev 4 | ms.author: joverslu 5 | description: "The IsInRangeConverter allows users to convert a value to a boolean value, checking if the value is between minValue and maxValue." 6 | ms.date: 6/12/2021 7 | --- 8 | 9 | # Xamarin Community Toolkit IsInRangeConverter 10 | 11 | The `IsInRangeConverter` is a converter that allows users to convert a `object` value into a `boolean` value, checking if the value is between `MinValue` and `MaxValue`, returning `true` if the value is within the range and `false` if the value is out of the range. 12 | 13 | ## Syntax 14 | 15 | ``` 16 | 17 | 25 | 26 | 27 | 28 | 29 | 30 | 34 | 35 | 36 | 37 | 38 | 42 | 83 | 84 | 85 | 86 | ``` 87 | 88 | ## Properties 89 | 90 | |Property |Type |Description | 91 | |---------|---------|---------| 92 | | MinValue | object | The minimum value of the range. | 93 | | MaxValue | object | The maximum value of the range. | 94 | 95 | ## Sample Project 96 | 97 | [IsInRangeConverter sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/IsInRangeConverterPage.xaml) 98 | 99 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 100 | 101 | ## API 102 | 103 | * [IsInRangeConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/IsInRangeConverter.shared.cs) 104 | -------------------------------------------------------------------------------- /docs/converters/isnotnulloremptyconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit IsNotNullOrEmptyConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The IsNotNullOrEmptyConverter allows users to convert a binding value to a boolean indicating whether or not the binding value is null or empty." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit IsNotNullOrEmptyConverter 10 | 11 | The IsNotNullOrEmptyConverter is a converter that allows users to convert an incoming binding to a `bool` value. This value represents if the incoming binding value is **not** `null` or empty. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Sample 36 | 37 | > [!NOTE] 38 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 39 | 40 | 43 | 44 | ## API 45 | 46 | * [IsNotNullOrEmptyConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/IsNotNullOrEmptyConverter.shared.cs) 47 | -------------------------------------------------------------------------------- /docs/converters/isnulloremptyconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit IsNullOrEmptyConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The IsNullOrEmptyConverter allows users to convert a binding value to a boolean indicating whether or not the binding value is null or empty." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit IsNullOrEmptyConverter 10 | 11 | The IsNullOrEmptyConverter is a converter that allows users to convert an incoming binding to a `bool` value. This value represents if the incoming binding value is `null` or empty. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Sample 36 | 37 | > [!NOTE] 38 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 39 | 40 | 43 | 44 | ## API 45 | 46 | * [IsNullOrEmptyConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/IsNullOrEmptyConverter.shared.cs) 47 | -------------------------------------------------------------------------------- /docs/converters/itemselectedeventargsconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit ItemSelectedEventArgsConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The ItemSelectedEventArgsConverter allows users to convert ItemSelectedEventArgs to the item that was selected." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit ItemSelectedEventArgsConverter 10 | 11 | The ItemSelectedEventArgsConverter is a converter that allows users to extract the `SelectedItem` value from an [SelectedItemChangedEventArgs](/dotnet/api/xamarin.forms.selecteditemchangedeventargs) object. It can subsequently be used in combination with `EventToCommandBehavior`. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | ``` 38 | 39 | ## Sample 40 | 41 | [ItemSelectedEventArgsConverter sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/ItemSelectedEventArgsPage.xaml) 42 | 43 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 44 | 45 | ## API 46 | 47 | * [ItemSelectedEventArgsConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/ItemSelectedEventArgsConverter.shared.cs) 48 | -------------------------------------------------------------------------------- /docs/converters/itemtappedeventargsconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit ItemTappedEventArgsConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The ItemTappedEventArgsConverter allows users to convert ItemTappedEventArgs to the item that was selected." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit ItemTappedEventArgsConverter 10 | 11 | The ItemTappedEventArgsConverter is a converter that allows users to extract the `Item` value from an [ItemTappedEventArgs](/dotnet/api/xamarin.forms.itemtappedeventargs) object. It can subsequently be used in combination with `EventToCommandBehavior`. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | ``` 38 | 39 | ## Sample 40 | 41 | [ItemTappedEventArgsConverter sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/ItemTappedEventArgsPage.xaml) 42 | 43 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 44 | 45 | ## API 46 | 47 | * [ItemTappedEventArgsConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/ItemTappedEventArgsConverter.shared.cs) 48 | -------------------------------------------------------------------------------- /docs/converters/listisnotnulloremptyconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit ListIsNotNullOrEmptyConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The ListIsNotNullOrEmptyConverter allows users to convert a binding list value to a boolean indicating whether or not the binding value is null or an empty list." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit ListIsNotNullOrEmptyConverter 10 | 11 | The ListIsNotNullOrEmptyConverter is a converter that allows users to convert an incoming binding that implements `IEnumerable` to a `bool` value. This value represents if the incoming binding value is **not** `null` or an empty list. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Sample 36 | 37 | > [!NOTE] 38 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 39 | 40 | 43 | 44 | ## API 45 | 46 | * [ListIsNotNullOrEmptyConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/ListIsNotNullOrEmptyConverter.shared.cs) 47 | -------------------------------------------------------------------------------- /docs/converters/listisnulloremptyconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit ListIsNullOrEmptyConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The ListIsNullOrEmptyConverter allows users to convert a binding list value to a boolean indicating whether or not the binding value is null or an empty list." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit ListIsNullOrEmptyConverter 10 | 11 | The ListIsNullOrEmptyConverter is a converter that allows users to convert an incoming binding that implements `IEnumerable` to a `bool` value. This value represents if the incoming binding value is either `null` or an empty list. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Sample 36 | 37 | [ListIsNullOrEmptyConverter sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/ListIsNullOrEmptyPage.xaml) 38 | 39 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 40 | 41 | ## API 42 | 43 | * [ListIsNullOrEmptyConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/ListIsNullOrEmptyConverter.shared.cs) 44 | -------------------------------------------------------------------------------- /docs/converters/listtostringconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit ListToStringConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The ListToStringConverter allows users to convert a list of values to a single string value." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit ListToStringConverter 10 | 11 | The ListToStringConverter is a converter that allows users to convert an incoming binding that implements `IEnumerable` to a single `string` value. The `Separator` property is used to join the items in the `IEnumerable`. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Properties 36 | 37 | |Property |Type |Description | 38 | |---------|---------|---------| 39 | | Separator | string | The separator that will be used to join the items in the list. | 40 | 41 | ## Sample 42 | 43 | > [!NOTE] 44 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 45 | 46 | 49 | 50 | ## API 51 | 52 | * [ListToStringConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/ListToStringConverter.shared.cs) 53 | -------------------------------------------------------------------------------- /docs/converters/mathexpressionconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit MathExpressionConverter" 3 | author: sattew 4 | ms.author: joverslu 5 | description: "The MathExpressionConverter allows users to calculate an expression at runtime." 6 | ms.date: 04/01/2021 7 | --- 8 | 9 | # Xamarin Community Toolkit MathExpressionConverter 10 | 11 | ![Pre-release API.](~/images/pre-release.png) 12 | 13 | The `MathExpressionConverter`is a converter that allows users to calculate an expression at runtime from supplied arguments: 14 | 15 | - **x** or **x0** — The first argument 16 | - **x1** — The second argument 17 | - ... 18 | - **xN-1** — The N argument 19 | 20 | > [!WARNING] 21 | > Avoid negative operations, constants or variables such as "-cos(30)", "-x" or "-pi", which will return an error. Instead, use multiplication by -1. 22 | 23 | ## Syntax 24 | 25 | ```xaml 26 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 43 | 44 | 54 | 55 | 56 | 57 | ``` 58 | 59 | ## Operations 60 | 61 | | Operation | Example | Equivalent | 62 | | -- | -- | -- | 63 | | + | x + 1 | — | 64 | | - | x - 2 | — | 65 | | * | x * -3 | — | 66 | | / | x / 4 | — | 67 | | ^ | x ^ 5 | [Math.Pow](xref:System.Math.Pow*) | 68 | | abs | abs(x) | [Math.Abs](xref:System.Math.Abs*) | 69 | | acos | acos(x) | [Math.Acos](xref:System.Math.Acos*) | 70 | | asin | asin(x) | [Math.Asin](xref:System.Math.Asin*) | 71 | | atan | atan(x) | [Math.Atan](xref:System.Math.Atan*) | 72 | | atan2 | atan2(x, 10) | [Math.Atan2](xref:System.Math.Atan2*) | 73 | | ceiling | ceiling(x) | [Math.Ceiling](xref:System.Math.Ceiling*) | 74 | | cos | cos(x) | [Math.Cos](xref:System.Math.Cos*) | 75 | | cosh | cosh(x) | [Math.Cosh](xref:System.Math.Cosh*) | 76 | | exp | exp(x) | [Math.Exp](xref:System.Math.Exp*) | 77 | | floor | floor(x) | [Math.Floor](xref:System.Math.Floor*) | 78 | | ieeeremainder | ieeeremainder(x, 16) | [Math.IEEERemainder](xref:System.Math.IEEERemainder*) | 79 | | log | log(x, 17) | [Math.Log](xref:System.Math.Log*) | 80 | | max | max(x, 18) | [Math.Max](xref:System.Math.Max*) | 81 | | min | min(x, 19) | [Math.Min](xref:System.Math.Min*) | 82 | | pow | round(x, 2) | [Math.Pow](xref:System.Math.Pow*) | 83 | | round | round(x, 1) | [Math.Round](xref:System.Math.Round*) | 84 | | sign | sign(x) | [Math.Sign](xref:System.Math.Sign*) | 85 | | sin | sin(x) | [Math.Sin](xref:System.Math.Sin*) | 86 | | sinh | sinh(x) | [Math.Sinh](xref:System.Math.Sinh*) | 87 | | sqrt | sqrt(x) | [Math.Sqrt](xref:System.Math.Sqrt*) | 88 | | tan | tan(x) | [Math.Tan](xref:System.Math.Tan*) | 89 | | tanh | tanh(x) | [Math.Tanh](xref:System.Math.Tanh*) | 90 | | truncate | truncate(x) | [Math.Truncate](xref:System.Math.Truncate*) | 91 | 92 | ## Constants 93 | 94 | | Constant | Equivalent | 95 | | -- | -- | 96 | | e | [Math.E](xref:System.Math.E) | 97 | | pi | [Math.PI](xref:System.Math.PI) | 98 | 99 | ## Sample 100 | 101 | [MathExpressionConverter sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/MathExpressionConverterPage.xaml) 102 | 103 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 104 | 105 | ## API 106 | 107 | * [MathExpressionConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/MathExpressionConverter/MathExpressionConverter.shared.cs) 108 | * [MultiMathExpressionConverter.cs source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/MathExpressionConverter/MultiMathExpressionConverter.shared.cs) 109 | -------------------------------------------------------------------------------- /docs/converters/multiconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit MultiConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The MultiConverter allows users to offset elements on-screen based on the current active safe area." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit MultiConverter 10 | 11 | The MultiConverter is a converter that allows users to chain multiple converters together. The initial binding value is passed through to the first converter and, depending on what these converters return, that value is subsequently passed through to the next converter. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | ``` 41 | 42 | ## Working with parameters 43 | 44 | Due to the nature of how converters work it is not possible to pass parameters to each individual converter in the MultiConverter. To work around this an `IList` of `MultiConverterParameter` objects is accepted as the converter parameter of the MultiConverter. These objects represent the parameters you want to provide for each individual converter. The MultiConverter subsequently matches the type of one of its converters to the type provided in the `ConverterType` property of a `MultiConverterParameter`. It then takes the provided `Value` property and uses that as the `ConverterParameter` of that specific converter. 45 | 46 | ## Sample 47 | 48 | [MultiConverter sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/MultiConverterPage.xaml) 49 | 50 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 51 | 52 | ## API 53 | 54 | * [MultiConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/MultiConverter.shared.cs) 55 | 56 | ## Related video 57 | 58 | > [!Video https://channel9.msdn.com/Shows/XamarinShow/Xamarin-Community-Toolkit-MultiConverter--VariableMultiValueConverter/player] -------------------------------------------------------------------------------- /docs/converters/notequalconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit NotEqualConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The NotEqualConverter allows users to check whether or not a binding value does not equal another value." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit NotEqualConverter 10 | 11 | The NotEqualConverter is a converter that allows users to convert any value binding to a `boolean` depending on whether or not it is equal to a different value. The initial binding contains the object that will be compared and the `ConverterParameter` contains the object to compare it to. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Sample 36 | 37 | > [!NOTE] 38 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 39 | 40 | 43 | 44 | ## API 45 | 46 | * [NotEqualConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/NotEqualConverter.shared.cs) 47 | -------------------------------------------------------------------------------- /docs/converters/stringtolistconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit StringToListConverter" 3 | author: guoldev 4 | ms.author: joverslu 5 | description: "The StringToListConverter allows the users to convert a string value into a string array that contains the substrings in the string that are delimited by one or more separators." 6 | ms.date: 01/04/2021 7 | --- 8 | 9 | # Xamarin Community Toolkit StringToListConverter 10 | 11 | ![Pre-release API.](~/images/pre-release.png) 12 | 13 | The `StringToListConverter` is a converter that allows the users to convert a `string` value into a string array that contains the substrings in this string that are delimited by the `Separator`, `Separators`, or `ConverterParameter` property. 14 | 15 | ## Syntax 16 | 17 | ```xaml 18 | 19 | 25 | 26 | 27 | 28 | 29 | , 30 | . 31 | ; 32 | 33 | 34 | 35 | 36 | 37 | 38 | 61 | 62 | 63 | ``` 64 | 65 | ## Properties 66 | 67 | | Property | Type | Description | 68 | | -- | -- | -- | 69 | | Separator | string | The string that delimits the substrings in this string. | 70 | | Separators | IList\ | The strings that delimit the substrings in this string. | 71 | | SplitOptions | StringSplitOptions | A bitwise combination of the enumeration values that specifies whether to trim substrings and include empty substrings. | 72 | 73 | ## Sample project 74 | 75 | [StringToListConverter sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/StringToListConverterPage.xaml) 76 | 77 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 78 | 79 | ## API 80 | 81 | * [StringToListConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/StringToListConverter.shared.cs) 82 | -------------------------------------------------------------------------------- /docs/converters/textcaseconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit TextCaseConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The TextCaseConverter allows users to change the casing of a string value." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit TextCaseConverter 10 | 11 | The TextCaseConverter is a converter that allows users to convert the casing of an incoming `string` type binding. The `Type` property is used to define what kind of casing will be applied to the `string`. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | ``` 34 | 35 | ## Properties 36 | 37 | |Property |Type |Description | 38 | |---------|---------|---------| 39 | | Type | TextCaseType | The type of casing to apply to the `string` value. | 40 | 41 | ## TextCaseType 42 | 43 | The `TextCaseType` enumeration defines the following members: 44 | 45 | - `None` - Applies no specific formatting to the string. 46 | - `Upper` - Applies upper case formatting to the string. 47 | - `Lower` - Applies lower case formatting to the string. 48 | 49 | ## Sample 50 | 51 | > [!NOTE] 52 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 53 | 54 | 57 | 58 | ## API 59 | 60 | - [TextCaseConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/TextCaseConverter.shared.cs) 61 | - [TextCaseType source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/TextCaseType.shared.cs) 62 | -------------------------------------------------------------------------------- /docs/converters/variablemultivalueconverter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit VariableMultiValueConverter" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The VariableMultiValueConverter enables users to check whether or not multiple boolean binding values are true." 6 | ms.date: 12/03/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit VariableMultiValueConverter 10 | 11 | The VariableMultiValueConverter is a converter that allows users to convert multiple `boolean` value bindings to a single `boolean`. It does this by enabling them to specify whether `All`, `Any`, `None` or a specific number of values are `true`. This is useful when combined with the [MultiBinding](/xamarin/xamarin-forms/app-fundamentals/data-binding/multibinding) included in Xamarin.Forms. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | ``` 41 | 42 | ## Properties 43 | 44 | |Property |Type |Description | 45 | |---------|---------|---------| 46 | | ConditionType | MultiBindingCondition | Indicates how many values should be true out of the provided boolean values in the MultiBinding. Supports the following values: `All`, `None`, `Any`, `GreaterThan`, `LessThan`. | 47 | | Count | int | The number of values that should be true when using ConditionType `GreaterThan`, `LessThan` or `Exact`. | 48 | 49 | ## Sample 50 | 51 | [VariableMultiValueConverter sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Converters/VariableMultiValueConverterPage.xaml) 52 | 53 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 54 | 55 | ## API 56 | 57 | * [VariableMultiValueConverter source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/VariableMultiValueConverter.shared.cs) 58 | 59 | ## Related video 60 | 61 | > [!Video https://channel9.msdn.com/Shows/XamarinShow/Xamarin-Community-Toolkit-MultiConverter--VariableMultiValueConverter/player] -------------------------------------------------------------------------------- /docs/docfx.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": { 3 | "content": [ 4 | { 5 | "files": [ 6 | "**/*.md", 7 | "**/*.yml" 8 | ], 9 | "exclude": [ 10 | "**/obj/**", 11 | "**/includes/**", 12 | "_themes/**", 13 | "_themes.pdf/**", 14 | "**/docfx.json", 15 | "_repo.en-us/**", 16 | "README.md", 17 | "LICENSE", 18 | "LICENSE-CODE", 19 | "ThirdPartyNotices.md" 20 | ] 21 | } 22 | ], 23 | "resource": [ 24 | { 25 | "files": [ 26 | "**/*.png", 27 | "**/*.jpg", 28 | "**/*.jpeg", 29 | "**/*.gif", 30 | "**/*.svg" 31 | ], 32 | "exclude": [ 33 | "**/obj/**", 34 | "**/includes/**", 35 | "_themes/**", 36 | "_themes.pdf/**", 37 | "**/docfx.json", 38 | "_repo.en-us/**" 39 | ] 40 | } 41 | ], 42 | "overwrite": [], 43 | "externalReference": [], 44 | "globalMetadata": { 45 | "ms.subservice": "xamarin-community-toolkit", 46 | "ms.service": "xamarin", 47 | "uhfHeaderId":"MSDocsHeader-Xamarin", 48 | "breadcrumb_path": "/previous-versions/xamarin/community-toolkit/breadcrumb/toc.json", 49 | "extendBreadcrumb": true, 50 | "audience": "developer", 51 | "ms.topic": "conceptual", 52 | "searchScope": ["Xamarin"], 53 | "ROBOTS": "NOINDEX,NOFOLLOW", 54 | "is_archived": true, 55 | "is_retired": true, 56 | "feedback_system": "None", 57 | "learn_archive": "manual" 58 | }, 59 | "fileMetadata": {}, 60 | "template": [], 61 | "dest": "xamarin-communitytoolkit", 62 | "markdownEngineName": "markdig" 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /docs/effects/lifecycleeffect.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit LifecycleEffect" 3 | description: "This article explains how to use the LifecycleEffect, to determine when a VisualElement is loaded and unloaded from memory." 4 | author: pedro 5 | ms.author: joverslu 6 | ms.date: 03/11/2021 7 | --- 8 | 9 | # Xamarin Community Toolkit Lifecycle Effect 10 | 11 | The `LifecycleEffect` allows you to determine when a `VisualElement` has its renderer allocated by the platform. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 21 | 22 | 28 | 29 | 30 | 31 | 32 | 33 | 41 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | ``` 54 | 55 | The `LifeCycleEffect` event handlers are shown below: 56 | 57 | ```csharp 58 | void LifeCycleEffect_Loaded(object? sender, EventArgs e) 59 | { 60 | if (sender is Button) 61 | Console.WriteLine("Button loaded"); 62 | if (sender is Image) 63 | Console.WriteLine("Image loaded"); 64 | if (sender is Label) 65 | Console.WriteLine("Label loaded"); 66 | if (sender is StackLayout) 67 | Console.WriteLine("StackLayout loaded"); 68 | } 69 | 70 | void LifeCycleEffect_Unloaded(object? sender, EventArgs e) 71 | { 72 | if (sender is Button) 73 | Console.WriteLine("Button unloaded"); 74 | if (sender is Image) 75 | Console.WriteLine("Image unloaded"); 76 | if (sender is Label) 77 | Console.WriteLine("Label unloaded"); 78 | if (sender is StackLayout) 79 | Console.WriteLine("StackLayout unloaded"); 80 | } 81 | ``` 82 | 83 | ## Properties 84 | 85 | |Property |Type |Description | 86 | |---------|---------|---------| 87 | | Loaded | event| Triggers when the renderer for the `VisualElement` is allocated.| 88 | | Unloaded | event| Triggers when the renderer for the `VisualElement` is unallocated. | 89 | 90 | ## Sample 91 | 92 | [LifecycleEffect sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/develop/samples/XCT.Sample/Pages/Effects/LifeCycleEffectPage.xaml) 93 | 94 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 95 | 96 | ## Related video 97 | 98 | > [!Video https://channel9.msdn.com/Shows/XamarinShow/Lifecycle-Events-Xamarin-Community-Toolkit/player] -------------------------------------------------------------------------------- /docs/effects/safeareaeffect.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit SafeAreaEffect" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The SafeAreaEffect allows users to offset elements on-screen based on the current active safe area." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit SafeAreaEffect 10 | 11 | The `SafeAreaEffect` is an effect that can be added to any element through an attached property to indicate whether or not that element should take current safe areas into account. This is an area of the screen that is safe for all devices that use iOS 11 and greater. Specifically, it will help to make sure that content isn't clipped by rounded device corners, the home indicator, or the sensor housing on an iPhone X. The effect only targets iOS, meaning that on other platforms it does not do anything. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 17 | ... 18 | 19 | ``` 20 | 21 | ## Properties 22 | 23 | | Property | Type | Description | 24 | | -- | -- | -- | 25 | | SafeArea | SafeArea | Indicates which safe areas should be taken into account for this element. | 26 | 27 | ## Specifying a SafeArea 28 | 29 | The `SafeArea` property is of type `SafeArea`. This structure takes up to 4 `boolean` type values indicating which safe areas should be taken into account for the element that this effect is applied to. There are three possibilities when creating a `SafeArea` structure: 30 | 31 | - Create a `SafeArea` structure defined by a single uniform value. The single value is applied to the left, top, right, and bottom sides of the element. 32 | - Create a `SafeArea` structure defined by horizontal and vertical values. The horizontal value is symmetrically applied to the left and right sides of the element, with the vertical value being symmetrically applied to the top and bottom sides of the element. 33 | - Create a `SafeArea` structure defined by four distinct values that are applied to the left, top, right, and bottom sides of the element. 34 | 35 | ## Code-behind support 36 | 37 | This effect can be also be used from code-behind: 38 | 39 | ```csharp 40 | public partial class MainPage : ContentPage 41 | { 42 | public MainPage() 43 | { 44 | InitializeComponent(); 45 | SafeAreaEffect.SetSafeArea(stackLayout, new SafeArea(true)); 46 | } 47 | } 48 | ``` 49 | 50 | ## Sample 51 | 52 | [SafeAreaEffect sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Effects/SafeAreaEffectPage.xaml) 53 | 54 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 55 | 56 | ## API 57 | 58 | - [SafeAreaEffect source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/SafeArea/SafeAreaEffect.shared.cs) 59 | -------------------------------------------------------------------------------- /docs/extensions/imageresourceextension.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit ImageResourceExtension" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The ImageResourceExtension allows users to display an image from an embedded resource." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit ImageResourceExtension 10 | 11 | The `ImageResourceExtension` is an extension that can be used to display an image from an embedded resource. By providing the resource ID of the embedded resource to this extension, you can bind the embedded resource to the `Source` property of an [Image](/xamarin/xamarin-forms/user-interface/images) control. 12 | 13 | ## Syntax 14 | 15 | ```xaml 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ``` 28 | 29 | ## Sample 30 | 31 | > [!NOTE] 32 | > Currently there's no sample available for this feature yet. Want to add one? We are open to [community contributions](https://github.com/xamarin/XamarinCommunityToolkit). 33 | 34 | 37 | 38 | ## API 39 | 40 | * [ImageResourceExtension source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Extensions/ImageResourceExtension.shared.cs) 41 | -------------------------------------------------------------------------------- /docs/extensions/translateextension.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit TranslateExtension" 3 | author: sthewissen 4 | ms.author: joverslu 5 | description: "The TranslateExtension allows users to handle multi-language support in XAML at runtime." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Xamarin Community Toolkit TranslateExtension 10 | 11 | The `TranslateExtension` allows users to handle multi-language support at runtime. It uses the built-in [`LocalizationResourceManager`](../helpers/localizationresourcemanager.md) helper to retrieve the correct translation resource for the current active [`CultureInfo`](xref:System.Globalization.CultureInfo). 12 | 13 | 14 | ## Syntax 15 | 16 | ```xaml 17 | 21 | 22 | 23 | 24 | 29 | 30 | ``` 31 | 32 | ## Properties 33 | 34 | | Property | Type | Description | 35 | | -- | -- | -- | 36 | | StringFormat | string | Allows the user to provide additional formatting to the translated text. | 37 | | Text | string | The resource that will be translated. | 38 | 39 | ## Sample 40 | 41 | [Settings sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/SettingPage.xaml) 42 | 43 | You can see this in action in the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit). 44 | 45 | ## API 46 | 47 | - [TranslateExtension source code](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Extensions/TranslateExtension.shared.cs) 48 | 49 | ## Related links 50 | 51 | - [LocalizationResourceManager](../helpers/localizationresourcemanager.md) 52 | - [LocalizedString](../helpers/localizedstring.md) -------------------------------------------------------------------------------- /docs/get-started.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Getting Started with the Xamarin Community Toolkit" 3 | author: AlexHedley 4 | ms.author: joverslu 5 | description: "Overview of how to get started with the Xamarin Community Toolkit to build amazing Xamarin.Forms apps." 6 | ms.date: 10/09/2020 7 | --- 8 | 9 | # Getting Started with the Xamarin Community Toolkit 10 | 11 | The toolkit is available as a NuGet package that can be added to any existing or new project using Visual Studio. 12 | 13 | 1. Open an existing project, or create a new project using the Blank Forms App template. 14 | 15 | 2. In the Solution Explorer panel, right click on your project name and select **Manage NuGet Packages**. Search for **Xamarin.CommunityToolkit**, and choose the desired NuGet Package from the list. 16 | 17 | ![NuGet Package.](~/images/managenuget.png "Manage NuGet Package Image") 18 | 19 | 3. To add the namespace to the toolkit: 20 | 21 | * In your C# page, add: 22 | 23 | ```c# 24 | using Xamarin.CommunityToolkit; 25 | ``` 26 | 27 | * In your XAML page, add the namespace attribute: 28 | 29 | ```xaml 30 | xmlns:xct="http://xamarin.com/schemas/2020/toolkit" 31 | ``` 32 | 33 | 4. Check out the rest of the documentation to learn more about implementing specific features. 34 | 35 | ## Xamarin Show: Xamarin Community Toolkit introduction video 36 | 37 | > [!Video https://channel9.msdn.com/Shows/XamarinShow/Introducing-the-Xamarin-Community-Toolkit/player] 38 | 39 | ## Other resources 40 | 41 | Download the [Xamarin Community Toolkit Sample App](https://github.com/xamarin/XamarinCommunityToolkit) from the repository to see the controls in an actual app. 42 | 43 | We recommend developers who are new to Xamarin.Forms to visit the [Get started with Xamarin](/xamarin/get-started/) documentation. 44 | 45 | Visit the [Xamarin Community Toolkit GitHub Repository](https://github.com/xamarin/XamarinCommunityToolkit) to see the current source code, what is coming next, and clone the repository. Community contributions are welcome! 46 | -------------------------------------------------------------------------------- /docs/helpers/delegateweakeventmanager.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit DelegateWeakEventManager" 3 | author: brminnick 4 | ms.author: bramin 5 | description: "A Delegate event implementation that enables the garbage collector to collect an object without needing to unsubscribe event handlers." 6 | ms.date: 11/20/2020 7 | ms.custom: team=cloud_advocates 8 | ms.contributors: bramin-03042021 9 | --- 10 | 11 | # Xamarin Community Toolkit DelegateWeakEventManager 12 | 13 | An `event Delegate` implementation that enables the [garbage collector to collect an object without needing to unsubscribe event handlers](http://paulstovell.com/blog/weakevents). 14 | 15 | Inspired by [Xamarin.Forms.WeakEventManager](https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Core/WeakEventManager.cs), expanding the functionality of Xamarin.Forms.WeakEventManager to support `Delegate` events. 16 | 17 | ## Syntax 18 | 19 | ```csharp 20 | public DelegateWeakEventManager() 21 | ``` 22 | 23 | ## Methods 24 | 25 | | Methods | Return Type | Description | 26 | | -- | -- | -- | 27 | | AddEventHandler(Delegate, string eventName) | void | Adds the event handler. | 28 | | RemoveEventHandler(Delegate, string eventName) | void | Removes the event handler. | 29 | | HandleEvent(object, object, string | void | Invokes the event EventHandler. | 30 | | HandleEvent(string | void | Invokes the event Action. | 31 | | RaiseEvent(object, object, string | void | Invokes the event EventHandler. | 32 | | RaiseEvent(string | void | Invokes the event Action. | 33 | 34 | ## Examples 35 | 36 | This section shows how to use this type. 37 | 38 | ### Use Delegate 39 | 40 | ```csharp 41 | readonly DelegateWeakEventManager _propertyChangedEventManager = new DelegateWeakEventManager(); 42 | 43 | public event PropertyChangedEventHandler? PropertyChanged 44 | { 45 | add => _propertyChangedEventManager.AddEventHandler(value); 46 | remove => _propertyChangedEventManager.RemoveEventHandler(value); 47 | } 48 | 49 | void OnPropertyChanged([CallerMemberName]string propertyName = "") => _propertyChangedEventManager.RaiseEvent(this, new PropertyChangedEventArgs(propertyName), nameof(PropertyChanged)); 50 | ``` 51 | 52 | ### Use EventHandler 53 | 54 | ```csharp 55 | readonly DelegateWeakEventManager _canExecuteChangedEventManager = new DelegateWeakEventManager(); 56 | 57 | public event EventHandler CanExecuteChanged 58 | { 59 | add => _canExecuteChangedEventManager.AddEventHandler(value); 60 | remove => _canExecuteChangedEventManager.RemoveEventHandler(value); 61 | } 62 | 63 | void OnCanExecuteChanged() => _canExecuteChangedEventManager.RaiseEvent(this, EventArgs.Empty, nameof(CanExecuteChanged)); 64 | ``` 65 | 66 | ### Use Action 67 | 68 | ```csharp 69 | readonly DelegateWeakEventManager _weakActionEventManager = new DelegateWeakEventManager(); 70 | 71 | public event Action ActionEvent 72 | { 73 | add => _weakActionEventManager.AddEventHandler(value); 74 | remove => _weakActionEventManager.RemoveEventHandler(value); 75 | } 76 | 77 | void OnActionEvent(string message) => _weakActionEventManager.RaiseEvent(message, nameof(ActionEvent)); 78 | ``` 79 | 80 | ## API 81 | 82 | - [DelegateWeakEventManager](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/DelegateWeakEventManager.shared.cs) 83 | 84 | ## Related links 85 | 86 | - [WeakEventManager](weakeventmanagert.md) 87 | 88 | ## Related video 89 | 90 | > [!Video https://channel9.msdn.com/Shows/XamarinShow/Xamarin-Community-Toolkit-WeakEventManager-To-Stop-Memory-Leaks/player] 91 | -------------------------------------------------------------------------------- /docs/helpers/localizationresourcemanager.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit LocalizationResourceManager" 3 | author: maxkoshevoi 4 | ms.author: joverslu 5 | description: "The Xamarin Community Toolkit LocalizationResourceManager helper class enables users to respond to culture changes at runtime." 6 | ms.date: 2/20/2021 7 | --- 8 | 9 | # Xamarin Community Toolkit LocalizationResourceManager 10 | 11 | The `LocalizationResourceManager` class is a helper class that enables users to respond to culture changes at runtime. This class is typically used by the [`TranslateExtension`](../extensions/translateextension.md) class and [`LocalizedString`](localizedstring.md). 12 | 13 | ## Examples 14 | 15 | The following sections show examples of how to use the `LocalizationResourceManager` class. 16 | 17 | ### Initialization 18 | 19 | Call the `Init` method in your `App` class constructor, and pass your resource manager to it: 20 | 21 | ```csharp 22 | LocalizationResourceManager.Current.PropertyChanged += (_, _) => AppResources.Culture = LocalizationResourceManager.Current.CurrentCulture; 23 | LocalizationResourceManager.Current.Init(AppResources.ResourceManager); 24 | ``` 25 | 26 | You can also subscribe to the `PropertyChanged` event to ensure that your app responds to system culture changes. 27 | 28 | ### Change culture 29 | 30 | Use the `CurrentCulture` property to change the culture: 31 | 32 | ```csharp 33 | LocalizationResourceManager.Current.CurrentCulture = newCulture; 34 | ``` 35 | 36 | ## Properties 37 | 38 | | Property | Type | Description | 39 | | -- | -- | -- | 40 | | CurrentCulture | [CultureInfo](xref:System.Globalization.CultureInfo) | The culture used to provide resource values. | 41 | 42 | ## Methods 43 | 44 | | Methods | Return Type | Description | 45 | | -- | -- | -- | 46 | | Init(ResourceManager) | void | Initializes a LocalizationResourceManager. | 47 | | Init(ResourceManager, CultureInfo) | void | Initializes a LocalizationResourceManager. | 48 | | GetValue(string) | string | Retrieves the localized resource value based on `CurrentCulture`. | 49 | 50 | ## Events 51 | 52 | | Events | Description | 53 | | -- | -- | 54 | | PropertyChanged | Provides notification of a culture change. | 55 | 56 | ## Sample project 57 | 58 | [App class Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/App.xaml.cs) 59 | [Settings sample page Source](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/ViewModels/SettingViewModel.cs) 60 | 61 | You can see this class in action in the [Xamarin community toolkit sample app](https://github.com/xamarin/XamarinCommunityToolkit/tree/main/samples/XCT.Sample). 62 | 63 | ## API 64 | 65 | - [LocalizationResourceManager](https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Helpers/LocalizationResourceManager.shared.cs) 66 | 67 | ## Related links 68 | 69 | - [TranslateExtension](../extensions/translateextension.md) 70 | - [LocalizedString](localizedstring.md) 71 | -------------------------------------------------------------------------------- /docs/helpers/localizedstring.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Xamarin Community Toolkit LocalizedString" 3 | author: maxkoshevoi 4 | ms.author: joverslu 5 | description: "The LocalizedString class enables users to respond to system culture changes in C# code at runtime." 6 | ms.date: 2/20/2021 7 | --- 8 | 9 | # Xamarin Community Toolkit LocalizedString 10 | 11 | The `LocalizedString` class enables users to respond to system culture changes in C# code at runtime. It uses the built-in [LocalizationResourceManager](../helpers/localizationresourcemanager.md) helper class to react to changes in the active [CultureInfo](xref:System.Globalization.CultureInfo). 12 | 13 | ## Examples 14 | 15 | The following code raises the `PropertyChanged` event and regenerates the string using function provided in constructor, when the `LocalizationResourceManager.Current.PropertyChanged` event is raised. As a result, the page will be updated with the localized value using the new culture. 16 | 17 | ViewModel: 18 | 19 | ```csharp 20 | public LocalizedString AppVersion { get; } = new(() => string.Format(AppResources.Version, AppInfo.VersionString)); 21 | ``` 22 | 23 | Page: 24 | 25 | ```xaml 26 |